#include <bits/stdc++.h>
using namespace std;
int a[3010];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", a + i);
  printf("%d\n", n);
  for (int i = 0; i < n; ++i) {
    int minn = i;
    for (int j = i + 1; j < n; ++j)
      if (a[minn] > a[j]) minn = j;
    if (minn != i) swap(a[i], a[minn]);
    printf("%d %d\n", i, minn);
  }
  return 0;
}
