#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
int a[N], n, o[N], vis[N];
map<int, int> pos;
vector<pair<int, int> > ans;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    o[i] = i;
  }
  sort(o + 1, o + 1 + n, [&](int u, int v) {
    if (a[u] != a[v])
      return a[u] < a[v];
    else
      return u < v;
  });
  for (int i = 1; i <= n; i++) {
    pos[o[i]] = i;
  }
  for (int i = n; i > 0; i--) {
    vis[pos[i]] = 1;
    for (int j = pos[i] + 1; j <= n; j++) {
      if (vis[j]) continue;
      if (a[i] == a[o[j]]) continue;
      ans.push_back({o[j], i});
    }
  }
  printf("%d\n", ans.size());
  for (auto x : ans) printf("%d %d\n", x.first, x.second);
  return 0;
}
