#include <bits/stdc++.h>
using namespace std;
int a[3001];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<pair<int, int> > v;
  for (int i = 0; i < n; i++) {
    int min = i;
    for (int j = i + 1; j < n; j++) {
      if (a[j] < a[min]) min = j;
    }
    if (min != i) {
      int b = a[min];
      a[min] = a[i];
      a[i] = b;
      v.push_back(make_pair(i, min));
    }
  }
  cout << v.size() << endl;
  for (int i = 0; i < v.size(); i++) {
    cout << v[i].first << " " << v[i].second << endl;
  }
  return 0;
}
