#include <bits/stdc++.h>
int m;
int mi = -1;
int s[3000];
void mini(int j, int n) {
  int mm = 1000000002;
  for (int i = j; i < n; i++) {
    if (s[i] < mm) {
      mm = s[i];
      m = s[i];
      mi = i;
    }
  }
}
int main() {
  int n;
  scanf("%d", &n);
  int* ss = new int[2 * n + 10];
  for (int i = 0; i < 2 * n + 1; ss[i++] = -1)
    ;
  for (int i = 0; i < n; i++) scanf("%d", &s[i]);
  int k = 0, ii = 0, j = 0;
  while (j < n - 1) {
    mini(j, n);
    if (s[j] == m)
      j++;
    else {
      ss[ii++] = j;
      ss[ii++] = mi;
      int tmp = s[j];
      s[j] = s[mi];
      s[mi] = tmp;
      k++;
      j++;
    }
  }
  printf("%d\n", k);
  int i = 0;
  while (i < 2 * n + 1) {
    if (ss[i] == -1) return 0;
    printf("%d %d\n", ss[i], ss[i + 1]);
    i = i + 2;
  }
  return 0;
}
