#include <bits/stdc++.h>

#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define watch(x) cout << (#x) << " : " << x << '\n'
#define boost ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

void solve() {
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++)
        cin >> a[i];
    vector < pair<int, int> > ans;
    for (int i = 0; i < n; i++) {
        int mx_id = 0;
        for (int j = 0; j < n - i; j++)
            if (a[mx_id] < a[j])
                mx_id = j;
        reverse(a, a + mx_id + 1);
        reverse(a, a + n - i);
        if (1 != mx_id + 1)
            ans.push_back({1, mx_id + 1});
        if (1 != n - i)
            ans.push_back({1, n - i});
    }
    cout << (int) ans.size() << '\n';
    for (auto [l, r] : ans)
        cout << l << ' ' << r << '\n';
}

main () {
    boost;
    solve();
    return 0;
}
