#include <bits/stdc++.h>
using namespace std;
const int maxn = 3000 + 10;
int n, ans;
int x[maxn], y[maxn];
int d[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &d[i]);
  for (int i = 1; i <= n; i++) {
    int minx = d[i], pos = i;
    for (int j = i + 1; j <= n; j++) {
      if (minx > d[j]) {
        minx = d[j];
        pos = j;
      }
    }
    if (pos == i)
      continue;
    else {
      swap(d[i], d[pos]);
      x[++ans] = i;
      y[ans] = pos;
    }
  }
  printf("%d\n", ans);
  for (int i = 1; i <= ans; i++) printf("%d %d\n", x[i] - 1, y[i] - 1);
  return 0;
}
