#include <bits/stdc++.h>
using namespace std;
struct per {
  int in, ik;
};
int n, k = 0;
int a[3000];
int stan[3000][2];
void sortir() {
  for (int i = 0; i < n; i++) {
    int mini = a[i];
    int mn = i;
    int temp;
    for (int j = i; j < n; j++)
      if (a[j] < mini) {
        mini = a[j];
        mn = j;
      }
    if (mn != i) {
      temp = a[i];
      a[i] = a[mn];
      a[mn] = temp;
      stan[k][0] = i;
      stan[k][1] = mn;
      k++;
    }
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  sortir();
  cout << k << "\n";
  for (int i = 0; i < k; i++) {
    cout << stan[i][0] << " " << stan[i][1] << "\n";
  }
  return 0;
}
