#include<bits/stdc++.h>
#include<stdlib.h>
#define pb push_back
#define ff first
#define ss second
#define int long long
#define let long long
//#define mp make_pair
#define cin_arr(arr,n) for (int i=0; i<n;i++) cin>>arr[i];
#define cout_arr(arr,n) for (int i=0; i<n;i++) cout<<arr[i]<<" ";
#define cout_set(st) for (auto i:st) cout<<i<<" ";
#define endl '\n'
using namespace std;

vector<pair<int,int> >v;

int32_t main()
{
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);

    int n;
    cin>>n;
    int arr[n];
    cin_arr(arr,n);
    for (int i=0; i<n;i++) {
        for (int j=i+1; j<n;j++) {
            if (arr[i]>arr[j]) {
                v.pb({i+1,j+1});
                swap(arr[i],arr[j]);
            }
        }
    }
    cout<<v.size()<<endl;
    for (int i=0; i<v.size();i++) {
        cout<<v[i].ff<<" "<<v[i].ss<<endl;
    }
}
