#include <bits/stdc++.h>
using namespace std;
int num[3010];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> num[i];
  }
  int pos = 0;
  int cnt = 0;
  string s;
  while (pos < n) {
    int mn = num[pos], index = pos;
    for (int j = pos; j < n; ++j) {
      if (num[j] < mn) {
        mn = num[j];
        index = j;
      }
    }
    if (index != pos) {
      s = s + to_string(pos) + " " + to_string(index) + "\n";
      swap(num[pos], num[index]);
      ++cnt;
    }
    ++pos;
  }
  cout << cnt << endl;
  cout << s;
  return 0;
}
