#include <bits/stdc++.h>
const int MX = 1e5 + 100;
using namespace std;
long n, i, a[3000];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  cout << n << '\n';
  for (int i = 0; i < n; i++) {
    long mn = a[i], imn = i;
    for (int j = i; j < n; j++)
      if (mn > a[j]) {
        mn = a[j];
        imn = j;
      }
    cout << imn << " " << i << '\n';
    swap(a[i], a[imn]);
  }
  getchar();
  getchar();
  return 0;
}
