#include <bits/stdc++.h>
using namespace std;
template <typename T>
void printArray(T arr, int l) {
  for (int i = 0; i < l; i++) cout << arr[i] << " ";
  cout << endl;
}
vector<int> A;
vector<int> B;
vector<int> res1;
vector<int> res2;
int main(void) {
  int n;
  cin >> n;
  A.resize(n);
  B.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> A[i];
    B[i] = A[i];
  }
  cout << n << endl;
  for (int i = 0; i < n; i++) {
    int swapElem = i;
    for (int j = i + 1; j < n; j++) {
      if (A[j] <= A[swapElem]) swapElem = j;
    }
    cout << swapElem << " " << i << endl;
    swap(A[i], A[swapElem]);
  }
  return 0;
}
