#include <bits/stdc++.h>
using namespace std;
int a[3005], l[3005], r[3005];
int main() {
  int n;
  while (~scanf("%d", &n)) {
    int cnt = 0;
    for (int i = 0; i < n; i++) scanf("%d", &a[i]);
    int k, cur = 0;
    for (int i = 0; i < n - 1; i++) {
      k = i;
      for (int j = i + 1; j < n; j++)
        if (a[k] > a[j]) k = j;
      if (k != i) {
        swap(a[k], a[i]);
        l[cur] = i;
        r[cur++] = k;
      }
    }
    printf("%d\n", cur);
    for (int i = 0; i < cur; i++) printf("%d %d\n", l[i], r[i]);
  }
}
