#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

	ll n, a[32000] = {};
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    cout << n << "\n";
    for (int i = 0; i < n; i++)
    {
        ll m = 10000000000000, y = 0;
        for (int j = i; j < n; j++)
        {
            if (a[j] <= m)
            {
                m = a[j];
                y = j;
            }
        }
        cout << i + 1 << ' ' << y + 1 << "\n";
        for (int j = i; j < (j + y) / 2; j++)
            swap(a[j], a[y - j + i]);
    }
}
