#include <bits/stdc++.h>
using namespace std;
int n, c;
long long a[3001];
pair<int, int> sol[3001];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  c = 0;
  for (int i = 0; i < n; ++i) {
    int mn = i;
    for (int j = i + 1; j < n; ++j) {
      if (a[mn] > a[j]) {
        mn = j;
      }
    }
    if (a[mn] < a[i]) {
      swap(a[i], a[mn]);
      sol[c] = pair<int, int>(i, mn);
      ++c;
    }
  }
  cout << c << endl;
  for (int i = 0; i < c; ++i) {
    cout << sol[i].first << ' ' << sol[i].second << endl;
  }
  return 0;
}
