#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  std::vector<long long int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  cout << n << endl;
  for (int i = 0; i < n; i++) {
    int k = i;
    for (int j = i; j < n; j++)
      if (a[j] < a[k]) k = j;
    cout << i << " " << k << endl;
    swap(a[i], a[k]);
  }
}
