#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  cout << n << "\n";
  for (int i = 0; i < n; i++) {
    auto itr = find(a + i, a + n, *min_element(a + i, a + n));
    int index = distance(a, itr);
    swap(a[i], a[index]);
    cout << i << " " << index << "\n";
  }
}
