#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > v;
int main() {
  int n;
  cin >> n;
  long long *a = new long long[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n - 1; i++) {
    int t = i;
    for (int j = i + 1; j < n; j++) {
      if (a[t] > a[j]) {
        t = j;
      }
    }
    if (i != t) {
      swap(a[i], a[t]);
      v.push_back(make_pair(i, t));
    }
  }
  cout << v.size() << endl;
  for (int i = 0; i < v.size(); i++)
    cout << v[i].first << " " << v[i].second << endl;
  return 0;
}
