#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, a1, a2, arr[3333];
  vector<pair<int, int> > v;
  cin >> x;
  for (int i = 0; i < x; i++) cin >> arr[i];
  for (int i = 0; i < x - 1; i++) {
    a1 = a2 = i;
    for (int a = i + 1; a < x; a++) {
      if (arr[a] < arr[i] && arr[a] <= arr[a2]) {
        a2 = a;
      }
    }
    if (a1 != a2) {
      v.push_back(make_pair(a1, a2));
      swap(arr[a1], arr[a2]);
    }
  }
  cout << v.size() << endl;
  for (int i = 0; i < v.size(); i++)
    cout << v[i].first << " " << v[i].second << endl;
  return 0;
}
