#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
int cd[3333] = {0};
int n, m;
pair<int, int> ans[3333];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &cd[i]);
  for (int i = 1; i <= n; i++) {
    int mm = cd[i], bj = 0;
    for (int j = i + 1; j <= n; j++)
      if (cd[j] < mm) mm = cd[j], bj = j;
    if (bj) ans[++m] = make_pair(i, bj), swap(cd[i], cd[bj]);
  }
  printf("%d\n", m);
  for (int i = 1; i <= m; i++) {
    printf("%d %d\n", ans[i].first - 1, ans[i].second - 1);
  }
  return 0;
}
