#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include<algorithm>
using namespace std;

#define int long long

signed main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++)
        cin >> v[i];
    vector<int> k = v;
    sort(k.begin(), k.end());
    vector<string> ans;
    for (int i = 0; i < n; i++) {
        int f = k[i];
        int id = std::find(v.begin() + i, v.end(), f) - v.begin();
        ans.push_back((to_string(i + 1) + " " + to_string((id + 1))));
        reverse(v.begin() + i, v.begin() + id + 1);
    }
    cout << ans.size() << endl;
    for (int d = 0; d < ans.size(); d++)
        cout << ans[d] << endl;
}
