#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e3 + 10;
int n, a[MAXN], b[MAXN];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i], b[i] = a[i];
  sort(b + 1, b + n + 1);
  cout << n << endl;
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++)
      if (b[i] == a[j]) {
        cout << i - 1 << " " << j - 1 << endl;
        swap(a[i], a[j]);
        break;
      }
  }
}
