#include <iostream>
#include <vector>
#include <cmath>
#include <map>

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<string> ans;
    for (i = 0; i < n - 1; i++) {
        for (j = 0; j < n - i - 1; j++)
            if (v[j] > v[j + 1]) {
                swap(v[j], v[j + 1]);
                ans.push_back(to_string(j + 1) + " " + to_string(j + 2));
            }
    }
    cout<<ans.size()<<endl;
    for(auto x:ans)
        cout<<x<<endl;
}
