#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > ans;
const int inf = 3e3 + 9;
int a[inf];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int j;
  for (int i = 0; i < n; i++) {
    j = i;
    for (int z = i; z < n; z++)
      if (a[z] < a[j]) j = z;
    if (i != j) ans.push_back(make_pair(i, j));
    swap(a[j], a[i]);
  }
  cout << ans.size() << endl;
  for (auto o : ans) printf("%d %d\n", o.first, o.second);
}
