#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;
int arr[35005];
pair<int,int>brr[35005];
vector<pair<int,int> >v;
int32_t main()
{
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);

    int n;
    cin>>n;
    for (int i=0; i<n;i++) {
        cin>>arr[i];
        brr[i].ff=arr[i];
        brr[i].ss=i+1;
    }
    sort(brr,brr+n);
    for (int i=0; i<n;i++) {
        v.pb({i+1,brr[i].ss});
        int p=brr[i].ss;
        for (int j=0; j<n;j++) {
            if (brr[j].ss<p) {
                brr[j].ss=p-brr[j].ss+1;
            }
        }
    }

    cout<<v.size()<<endl;
    for (int i=0; i<v.size();i++) {
        cout<<v[i].ff<< " "<<v[i].ss<<endl;
    }
}
//2 4 3 5 1
