#include <bits/stdc++.h>
using namespace std;
int swap(int array[], int i, int j) {
  int x = array[i];
  array[i] = array[j];
  array[j] = x;
}
int main() {
  int n, arr[3005];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  vector<int> v;
  for (int i = 0; i < n; i++) {
    int min = i;
    for (int j = i + 1; j < n; j++) {
      if (arr[j] < arr[min]) min = j;
    }
    if (min != i) {
      swap(arr, i, min);
      v.push_back(i);
      v.push_back(min);
    }
  }
  cout << v.size() / 2 << endl;
  for (auto i = v.begin(); i != v.end(); i++) {
    cout << *i << " ";
    i++;
    cout << *i << endl;
  }
}
