#include <bits/stdc++.h>
using namespace std;
pair<int, int> a[1003];
map<pair<int, int>, int> temp;
int num[1003];
int permutation[1003];
int n;
vector<pair<int, int>> ans;
int pos[1003];
int main() {
  cin >> n;
  int i, j;
  for (i = 1; i <= n; i++) scanf("%d", num + i);
  for (i = 1; i <= n; i++) {
    a[i].second = num[i];
    a[i].first = i;
  }
  sort(a + 1, a + 1 + n, [](const pair<int, int>& x, const pair<int, int>& y) {
    if (x.second == y.second)
      return x.first < y.first;
    else
      return x.second < y.second;
  });
  for (i = 1; i <= n; i++) temp[make_pair(a[i].first, a[i].second)] = i;
  for (i = 1; i <= n; i++) permutation[i] = temp[make_pair(i, num[i])];
  for (i = n; i >= 1; i--) {
    for (j = 1; j <= i; j++) pos[permutation[j]] = j;
    for (j = permutation[i] + 1; j <= i; j++) {
      swap(permutation[i], permutation[pos[j]]);
      ans.push_back(make_pair(pos[j], i));
    }
  }
  cout << ans.size() << endl;
  for (auto v : ans) printf("%d %d\n", v.first, v.second);
  return 0;
}
