#include <bits/stdc++.h>
using namespace std;
int n;
pair<int, int> a[1002];
vector<pair<int, int>> ans;
bool cmp(pair<int, int> aa, pair<int, int> bb) {
  if (aa.second != bb.second) return aa.second > bb.second;
  return aa.first < bb.first;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i + 1;
  }
  for (int i = n - 1; i >= 0; i--) {
    vector<pair<int, int>> tmp;
    for (int j = 0; j < i; j++) {
      if (a[j].first > a[i].first) tmp.push_back(a[j]);
    }
    sort(tmp.begin(), tmp.end());
    for (auto u : tmp) ans.push_back({u.second, a[i].second});
  }
  cout << ans.size() << "\n";
  for (auto u : ans) cout << u.first << " " << u.second << "\n";
}
