#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
const int N = 2e5 + 30;

int a[N];

void swapp (int x, int y) {
    while (x < y) {
        swap (a[x], a[y]);
        ++x, --y;
    }
    return ;
}

int main()
{
    ios_base::sync_with_stdio (0);
    cin.tie (0);
    cout.tie (0);
    int n, m;
    cin >> n ;
    vector < pair < int , int > > v;
    for (int i = 0; i < n; ++i) cin >> a[i];
    for (int i = 0; i < n; ++i) {
        int mn = i;
        for (int j = i; j < n; ++j) {
            if (a[mn] > a[j])
                mn = j;
        }
        swapp (i, mn);
        v.push_back ({i, mn});
    }
    cout << n << "\n";
    for (auto i : v) cout << i.first + 1 << " " << i.second + 1 << "\n";
    return 0;
}
