#include <bits/stdc++.h>
using namespace std;
int a[3001];
void swap(int i, int j) {
  int temp = a[i];
  a[i] = a[j];
  a[j] = temp;
}
int main() {
  int n;
  cin >> n;
  ;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<pair<int, int> > x;
  for (int i = 0; i < n; i++) {
    int min = a[i];
    int sw = i;
    for (int j = i + 1; j < n; j++) {
      if (a[j] < min) {
        min = a[j];
        sw = j;
      }
    }
    if (sw != i) {
      x.push_back(make_pair(i, sw));
      swap(i, sw);
    }
  }
  cout << x.size() << endl;
  for (vector<pair<int, int> >::iterator i = x.begin(); i != x.end(); i++) {
    cout << (*i).first << " " << (*i).second << endl;
  }
  return 0;
}
