#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, i, j, a[10000], min, s;
  cin >> n;
  for (i = 0; i <= n - 1; i++) cin >> a[i];
  cout << n;
  cout << endl;
  for (i = 0; i <= n - 1; i++) {
    min = a[i];
    s = i;
    for (j = i; j <= n - 1; j++) {
      if (min > a[j]) {
        min = a[j];
        s = j;
      }
    }
    cout << i << ' ' << s << endl;
    swap(a[i], a[s]);
  }
  return 0;
}
