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