#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long arr[n];
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  vector<pair<long long, long long> > v;
  for (long long i = 0; i < n; i++) {
    long long j = i;
    for (long long t = i; t < n; t++)
      if (arr[j] > arr[t]) j = t;
    if (i != j) v.push_back(make_pair(i, j));
    swap(arr[i], arr[j]);
  }
  cout << v.size() << "\n";
  for (long long j = 0; j < v.size(); j++) {
    cout << v[j].first << " " << v[j].second << "\n";
  }
  return 0;
}
