#include <bits/stdc++.h>
using namespace std;
int ar[100000];
int main() {
  long long a, b = 0, k, n, i, j = 2, a1, b1, c1 = 0, ma, mi, id, sum = 0;
  vector<pair<int, int> > v;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> ar[i];
  }
  for (i = 0; i < n; i++) {
    mi = ar[i];
    ma = INT_MAX;
    for (j = i + 1; j < n; j++) {
      if (ar[j] < ma) {
        ma = ar[j];
        id = j;
      }
    }
    if (ma < mi) {
      swap(ar[i], ar[id]);
      v.push_back({i, id});
    }
  }
  cout << v.size() << endl;
  for (i = 0; i < v.size(); i++) {
    cout << v[i].first << " " << v[i].second << endl;
  }
  cout << endl;
}
