#include <bits/stdc++.h>
using namespace std;
int level[101] = {0};
int main() {
  int i, n;
  cin >> n;
  long long array[n];
  pair<int, int> pair1;
  vector<pair<int, int> > v;
  for (i = 0; i < n; i++) cin >> array[i];
  long long min1;
  int index;
  i = 0;
  while (i < n) {
    min1 = array[i];
    index = i;
    for (int j = i; j < n; j++) {
      if (min1 > array[j]) {
        min1 = array[j];
        index = j;
      }
    }
    if (min1 < array[i]) {
      pair1.first = i;
      pair1.second = index;
      swap(array[index], array[i]);
      v.push_back(pair1);
    }
    i++;
  }
  cout << v.size() << endl;
  for (int i = 0; i < v.size(); i++)
    cout << v[i].first << " " << v[i].second << endl;
  return 0;
}
