#include <bits/stdc++.h>
using namespace std;
long long gcd(int x, int y) {
  return !y ? (long long)x : (long long)gcd(y, x % y);
}
int main() {
  int n, best, idx;
  cin >> n;
  vector<int> array(n);
  vector<pair<int, int> > ans;
  for (long long i = 0; i < n; i++) scanf("%d", &array[i]);
  for (long long i = 0; i < n - 1; i++) {
    best = (long long)2e9 + 1, idx = -1;
    for (long long j = i + 1; j < n; j++)
      if (array[j] < array[i] && array[j] <= best) idx = j, best = array[j];
    if (idx != -1) ans.push_back(make_pair(i, idx)), swap(array[i], array[idx]);
  }
  printf("%d\n", ans.size());
  for (long long i = 0; i < ans.size(); i++)
    cout << ans[i].first << " " << ans[i].second << endl;
  return 0;
}
