#include <bits/stdc++.h>
using namespace std;
int n, i, arr[3001];
int idx, j, mn = 1000000002;
int main() {
  cin >> n;
  for (i = 0; i < n; i++) cin >> arr[i];
  cout << n << endl;
  for (i = 0; i < n; i++) {
    idx = i;
    for (j = i; j < n; j++)
      if (arr[j] < arr[idx]) idx = j;
    swap(arr[idx], arr[i]);
    cout << i << " " << idx << endl;
  }
}
