#include <bits/stdc++.h>
using namespace std;
struct stru {
  int element, index;
};
vector<stru> arr;
vector<int> sum;
int main() {
  int i, n, num, ind_1, ind_2, sum_total, c;
  bool flag;
  while (scanf("%d", &n) != EOF) {
    for (i = 0; i < n; i++) {
      arr.push_back(stru());
      scanf("%d", &arr[i].element);
      arr[i].index = i;
    }
    for (i = 0, sum_total = 0; i < n; i++) {
      num = arr[i].element;
      for (c = i + 1, flag = 0, ind_1 = i; c < n; c++) {
        if (arr[c].element < num) {
          num = arr[c].element;
          ind_2 = arr[c].index;
          flag = 1;
        }
      }
      if (flag == 1) {
        swap(arr[i].element, arr[ind_2].element);
        sum_total++;
        sum.push_back(ind_1);
        sum.push_back(ind_2);
      }
    }
    printf("%d\n", sum_total);
    for (i = 0; i < sum_total * 2; i += 2) {
      printf("%d %d\n", sum[i], sum[i + 1]);
    }
  }
}
