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