#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, p, count = 0;
  scanf("%d", &n);
  vector<pair<int, int> > A(n), B(n);
  int iToP[3001], pToI[3001];
  for (int i = 0; i < (n); ++i) {
    scanf("%d", &a);
    A[i] = make_pair(a, i);
  }
  sort(A.begin(), A.end());
  for (int i = 0; i < (n); ++i) {
    iToP[i] = A[i].second;
    pToI[A[i].second] = i;
  }
  for (int i = 0; i < (n); ++i) {
    p = iToP[i];
    if (p != i) {
      a = pToI[i];
      B[count++] = make_pair(p, i);
      iToP[i] = i;
      pToI[i] = i;
      iToP[a] = p;
      pToI[p] = a;
    }
  }
  printf("%d\n", count);
  for (int i = 0; i < (count); ++i) {
    printf("%d %d\n", B[i].first, B[i].second);
  }
  return 0;
}
