#include <bits/stdc++.h>
template <class T>
T gcd(T a, T b) {
  T r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
using namespace std;
int n;
pair<int, int> a[100005];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i].first, a[i].second = i;
  sort(a, a + n);
  vector<pair<int, int> > P;
  for (int i = 0; i < n; i++) {
    if (a[i].second != i) {
      P.push_back({i, a[i].second});
      swap(a[i], a[a[i].second]);
      i--;
    }
  }
  cout << P.size() << endl;
  for (int i = P.size(); i--;) cout << P[i].first << " " << P[i].second << endl;
}
