#include <bits/stdc++.h>
int a[4000];
int n;
using namespace std;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<pair<int, int> > q;
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    int minelemIx = i;
    for (int j = i + 1; j < n; j++) {
      if (a[minelemIx] > a[j]) {
        minelemIx = j;
      }
    }
    swap(a[i], a[minelemIx]);
    q.push_back(make_pair(i, minelemIx));
  }
  cout << q.size() << endl;
  for (int i = 0; i < q.size(); i++) {
    cout << q[i].first << ' ' << q[i].second << endl;
  }
}
