#include <bits/stdc++.h>
using namespace std;
const int MX = 25;
int main(int argc, char *argv[]) {
  ios ::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int a[n];
  for (int i = (0), _b = (n); i < (_b); ++i) cin >> a[i];
  int b[n];
  for (int i = (0), _b = (n); i < (_b); ++i) b[i] = a[i];
  sort(b, b + n);
  vector<pair<int, int> > ans;
  for (int i = (0), _b = (n); i < (_b); ++i) {
    for (int j = (i), _b = (n); j < (_b); ++j) {
      if (b[i] == a[j]) {
        if (j > i) {
          ans.push_back(pair<int, int>(i, j));
          swap(a[i], a[j]);
        }
        break;
      }
    }
  }
  cout << ans.size() << '\n';
  for (int i = (0), _b = (ans.size()); i < (_b); ++i)
    cout << ans[i].first << " " << ans[i].second << '\n';
  return 0;
}
