#include <bits/stdc++.h>
using namespace std;
int n, res = 0;
vector<int> a;
vector<pair<int, int> > kq;
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    a.push_back(x);
  }
  for (int i = 0; i < n - 1; ++i) {
    int tg = a[i];
    int vt = -1;
    for (int j = i + 1; j < n; ++j)
      if (a[j] < tg) {
        tg = a[j];
        vt = j;
      }
    if (vt != -1) {
      res++;
      pair<int, int> k;
      k = make_pair(i, vt);
      tg = a[i];
      a[i] = a[vt];
      a[vt] = tg;
      kq.push_back(k);
    }
  }
  cout << res << endl;
  for (int i = 0; i < kq.size(); i++)
    printf("%d %d\n", kq[i].first, kq[i].second);
  return 0;
}
