#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    v[i] = a;
  }
  vector<tuple<int, int, int>> vii;
  for (int i = 0; i < n - 1; i++) {
    for (int j = n - 1; j > i; j--) {
      if (v[j] < v[i]) {
        vii.push_back(make_tuple(v[i], i + 1, j + 1));
      }
    }
  }
  int s = vii.size();
  sort(vii.begin(), vii.end(),
       [](tuple<int, int, int> a, tuple<int, int, int> b) {
         if (get<0>(a) == get<0>(b)) {
           if (get<1>(a) == get<1>(b)) {
             return get<2>(a) > get<2>(b);
           }
           return get<1>(a) < get<1>(b);
         }
         return get<0>(a) < get<0>(b);
       });
  cout << s << '\n';
  for (int i = 0; i < s; i++) {
    cout << get<1>(vii[i]) << " " << get<2>(vii[i]) << '\n';
  }
}
