#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    int a[10000], b[10000], c[10000];
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
      b[i] = a[i];
    }
    sort(a, a + n);
    int ans = 0, u = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] != b[i]) {
        for (int j = i; j < n; j++) {
          if (b[j] == a[i]) {
            swap(b[j], b[i]);
            c[u++] = j;
            c[u++] = i;
            ans++;
            break;
          }
        }
      }
    }
    printf("%d\n", ans);
    for (int i = 0; i < u; i++) {
      if (i % 2 == 0)
        printf("%d ", c[i]);
      else
        printf("%d\n", c[i]);
    }
  }
}
