#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int a[3200];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  int m, cnt = 0, j;
  int k = 0, ans1[3000], ans2[3000];
  for (int i = 0; i < n; i++) {
    m = i;
    for (j = i + 1; j < n; j++) {
      if (a[j] < a[m]) {
        m = j;
      }
    }
    if (m != i) {
      cnt += 1;
      ans1[k] = i;
      ans2[k++] = m;
      swap(a[m], a[i]);
    }
  }
  cout << cnt << endl;
  if (cnt != 0) {
    for (int i = 0; i < k; i++) cout << ans1[i] << " " << ans2[i] << endl;
  }
  return 0;
}
