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