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