#include <bits/stdc++.h>
using namespace std;
int llCmpFn(const void* a, const void* b) {
  return *(long long*)a - *(long long*)b;
}
int main() {
  long long n;
  cin >> n;
  long long arr[n], sorted[n], results[2][n];
  long long swaps = 0;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
    sorted[i] = arr[i];
  }
  qsort(sorted, n, sizeof(long long), llCmpFn);
  for (int i = 0; i < n; i++) {
    if (arr[i] == sorted[i]) continue;
    for (int j = i + 1; j < n; j++) {
      if (arr[j] != sorted[i]) continue;
      swap(arr[i], arr[j]);
      results[0][swaps] = i, results[1][swaps] = j;
      swaps++;
      break;
    }
  }
  cout << swaps << endl;
  for (int i = 0; i < swaps; i++) {
    cout << results[0][i] << " " << results[1][i] << endl;
  }
  return 0;
}
