#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, sw = 0, k = 0;
  int i, j, minn, ind, temp;
  int arr[10000], arr1[10000], arr2[10000];
  cin >> n;
  for (i = 0; i < n; i++) cin >> arr[i];
  for (i = 0; i < n; i++) {
    minn = 1000000001;
    for (j = i + 1; j < n; j++) {
      if (arr[j] < minn) {
        minn = arr[j];
        ind = j;
      }
    }
    if (minn < arr[i]) {
      sw++;
      arr1[k] = i;
      arr2[k] = ind;
      temp = arr[i];
      arr[i] = minn;
      arr[ind] = temp;
      k++;
    }
  }
  cout << sw << endl;
  for (i = 0; i < k; i++) cout << arr1[i] << " " << arr2[i] << endl;
  return 0;
}
