#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<int, int> > inp(n);
  vector<pair<int, int> > v(n);
  for (int i = 0; i < n; i++) {
    cin >> inp[i].first;
    inp[i].second = i;
  }
  v = inp;
  sort(inp.begin(), inp.end());
  int t = 0;
  pair<int, int> tmp;
  vector<pair<int, int> > ans;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (inp[i].first == v[j].first && inp[i].second == v[j].second) {
        tmp.first = i;
        tmp.second = j;
        ans.push_back(tmp);
        ++t;
        swap(v[i], v[j]);
      }
    }
  }
  cout << t << endl;
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i].first << " " << ans[i].second << endl;
  }
}
