#include <bits/stdc++.h>
int main() {
  int n, i, j, k = 0, minIndex, counter = 0;
  scanf("%d", &n);
  long long int array[n], min, temp;
  int source[n], destination[n];
  for (i = 0; i < n; i++) scanf("%I64d", &array[i]);
  for (i = 0; i < n; i++) {
    min = array[i];
    for (j = i; j < n; j++) {
      if (array[j] < min) {
        min = array[j];
        minIndex = j;
      }
    }
    if (min != array[i]) {
      temp = array[minIndex];
      array[minIndex] = array[i];
      array[i] = temp;
      source[k] = minIndex;
      destination[k] = i;
      k++;
      counter++;
    }
  }
  printf("%d\n", counter);
  for (i = 0; i < counter; i++) printf("%d %d\n", source[i], destination[i]);
  return 0;
}
