#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, n, z, mi, j, k, kol;
  int a[3010];
  int b[3000][2];
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  kol = 0;
  for (i = 1; i < n; i++) {
    mi = a[i];
    k = i;
    for (j = i + 1; j <= n; j++) {
      if (mi > a[j]) {
        mi = a[j];
        k = j;
      }
    }
    if (a[i] > mi) {
      b[kol + 1][1] = i;
      b[kol + 1][2] = k;
      z = a[i];
      a[i] = mi;
      a[k] = z;
      kol++;
    }
  }
  cout << kol << endl;
  for (i = 1; i <= kol; i++) cout << b[i][1] - 1 << " " << b[i][2] - 1 << endl;
  return 0;
}
