#include <bits/stdc++.h>
using namespace std;
struct d {
  int i, x, v;
  bool operator<(const d& p) const {
    if (v == p.v) return x > p.x;
    return v > p.v;
  }
};
int main() {
  int N;
  cin >> N;
  int num[N];
  vector<d> V;
  vector<pair<int, int> > S;
  for (int i = 0; i < N; i++) {
    cin >> num[i];
  }
  for (int i = 0; i < N; i++) {
    V.resize(0);
    for (int x = i + 1; x < N; x++) {
      if (num[x] < num[i]) {
        V.push_back({i, x, num[x]});
      }
    }
    sort(V.begin(), V.end());
    for (int x = 0; x < V.size(); x++) {
      S.push_back(make_pair(V[x].i, V[x].x));
    }
  }
  cout << S.size() << "\n";
  for (int i = 0; i < S.size(); i++) {
    cout << S[i].first + 1 << " " << S[i].second + 1 << "\n";
  }
  cout << "\n";
  return 0;
}
