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