//
//  main.cpp
//  5
//
//  Created by Igor Romaniuk (del1ke) on 21.05.2022.
//
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimization("funroll-loops")
#pragma GCC target("avx")
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long
#define ull unsigned ll
#define ld long double
#define pb push_back
#define fi first
#define se second
#define stop break
#define skip continue
#define elif else if
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define EXIT return 0
#define SZ(a) (ll)a.size()
#define PB push_back
#define pll pair<ll, ll>
#define pii pair<int, int>
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define PI acos((ld)-1)
#define em emplace_back
#define all(x) x.begin(), x.end()
#define E exp((ld)1)
const ll MOD = 1e9 + 7, DIM = 1e5 + 7, INF = 1e12 + 7;
signed main() {
    FAST;
    ll n;
    vector<pii> ans;
    cin >> n;
    int v[n];
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    for (int i = 0; i < n; i++) {
        ll min = 32000, pos = -1;
        for (int j = i; j < n; j++)
            if (v[j] <= v[i]) {
                min = v[i];
                pos = j;
            }
        if (pos != i) {
            reverse(v + i, v + j + 1);
            ans.PB(i, j);
        }
    }
    cout << SZ(ans) << "\n";
    for (auto to : ans) {
        cout << to.fi << " " << to.se << "\n";
    }
    EXIT;
}
