#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, tmp, minim, minid;
  scanf("%d", &n);
  ;
  vector<int> v;
  vector<pair<int, int> > res;
  for (int i = (int)1; i <= (int)n; i++) {
    scanf("%d", &tmp);
    v.push_back(tmp);
  }
  for (int i = (int)0; i <= (int)n - 1; i++) {
    minim = 2000000000;
    for (int j = (int)i; j <= (int)n - 1; j++) {
      if (v[j] < minim) {
        minim = v[j];
        minid = j;
      }
    }
    res.push_back(make_pair(i, minid));
    swap(v[i], v[minid]);
  }
  printf("%d\n", res.size());
  for (int i = (int)0; i <= (int)res.size() - 1; i++) {
    printf("%d %d\n", res[i].first, res[i].second);
  }
  return 0;
}
