#include <bits/stdc++.h>
using namespace std;
int n, a[1005];
vector<pair<int, int> > v, ans;
bool comp(pair<int, int> a, pair<int, int> b) {
  if (a.first != b.first)
    return a.first > b.first;
  else
    return a.second > b.second;
}
int32_t main() {
  ios_base ::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    v.clear();
    for (int j = i + 1; j <= n; j++) {
      if (a[j] < a[i]) v.push_back({a[j], j});
    }
    sort(v.begin(), v.end(), comp);
    for (pair<int, int> j : v) ans.push_back({i, j.second});
  }
  cout << ans.size() << '\n';
  for (pair<int, int> i : ans) {
    cout << i.first << ' ' << i.second << '\n';
  }
}
