#include <bits/stdc++.h>
using namespace std;
using big = long long;
const int N = 2020;
int a[N];
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  vector<pair<int, int>> ps;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j < i; ++j) {
      if (a[j] > a[i]) {
        ps.push_back({j, i});
      }
    }
  }
  sort(ps.begin(), ps.end(),
       [](const pair<int, int> p1, const pair<int, int> p2) {
         if (a[p1.first] != a[p2.first]) {
           return a[p1.first] < a[p2.first];
         }
         if (p1.first != p2.first) {
           return p1.first < p2.first;
         }
         return p1.second > p2.second;
       });
  cout << ps.size() << endl;
  for (const auto p : ps) {
    cout << p.first << " " << p.second << '\n';
  }
  return 0;
}
