#include <bits/stdc++.h>
using namespace std;
int f[100010], g[100010], h[100010];
int n, p, t1, t2, t3;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &f[i]);
  }
  p = 0;
  for (int i = 1; i <= n; i++) {
    t1 = f[i];
    t2 = 0;
    for (int j = i + 1; j <= n; j++)
      if (f[j] < t1) t1 = f[j], t2 = j;
    if (t2 != 0) {
      p++;
      g[p] = i - 1;
      h[p] = t2 - 1;
      t3 = f[i];
      f[i] = t1;
      f[t2] = t3;
    }
  }
  printf("%d\n", p);
  for (int i = 1; i <= p; i++) printf("%d %d\n", g[i], h[i]);
  return 0;
}
