#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, int> > v, g;
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  long long x[2101];
  for (int i = 1; i <= n; i++) {
    cin >> x[i];
    v.push_back(make_pair(x[i], i));
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < v.size(); i++) {
    int j = v[i].second;
    for (int k = n; k > j; k--) {
      if (x[k] < x[j]) g.push_back(make_pair(j, k));
    }
  }
  cout << g.size() << endl;
  for (int i = 0; i < g.size(); i++)
    cout << g[i].first << ' ' << g[i].second << endl;
  return 0;
}
