#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const int INF = 1e9;
const int MOD = 1000000007;
const int M = INF;
const double RRR = 180.0 / PI;
const int base = 1000 * 1000 * 1000;
int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  b = a;
  sort(b.begin(), b.end());
  vector<pair<int, int> > ans;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (b[i] == a[j]) {
        ans.push_back(make_pair(i, j));
        swap(a[i], a[j]);
        break;
      }
    }
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++)
    cout << ans[i].first << " " << ans[i].second << endl;
  return 0;
}
