#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int swaps = 0;
  int swapdata[n][2];
  int dataindex = 0;
  long long int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (int j = 0; j < n; j++) {
    int min = arr[j];
    int minind = j;
    for (int k = j + 1; k < n; k++) {
      if (arr[k] < min) {
        min = arr[k];
        minind = k;
      }
    }
    if (minind != -1) {
      int temp;
      temp = arr[minind];
      arr[minind] = arr[j];
      arr[j] = temp;
      if (j != minind) {
        swaps++;
        swapdata[dataindex][0] = j;
        swapdata[dataindex][1] = minind;
        dataindex++;
      }
    }
  }
  cout << swaps << endl;
  for (int i = 0; i < dataindex; i++) {
    cout << swapdata[i][0] << " " << swapdata[i][1] << endl;
  }
  return 0;
}
