#include <bits/stdc++.h>
using namespace std;
int n, a[3003], s[3003], sz;
vector<pair<int, int> > V;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    s[i] = a[i];
  }
  sort(s, s + n);
  for (int i = 0; i < n; i++) {
    if (s[i] == a[i]) continue;
    for (int j = i + 1; j < n; j++) {
      if (s[i] == a[j]) {
        swap(a[i], a[j]);
        V.push_back(pair<int, int>(i, j));
        break;
      }
    }
  }
  sz = V.size();
  cout << sz << '\n';
  for (int i = 0; i < sz; i++) cout << V[i].first << ' ' << V[i].second << '\n';
  return 0;
}
