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