#include <bits/stdc++.h>
using namespace std;
long long mod = pow(10, 9) + 7;
bool comparator(vector<int> &p1, vector<int> &p2) {
  if (p1[1] > p2[1]) {
    return true;
  } else if (p2[1] == p1[1]) {
    if (p1[2] < p2[2]) {
      return true;
    } else if (p1[2] == p2[2]) {
      return (p1[0] < p2[0]);
    }
  }
  return false;
}
int main() {
  int n;
  cin >> n;
  vector<int> A(n);
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  vector<vector<int>> inversion;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (A[i] > A[j]) {
        inversion.push_back({i, j, A[i], A[j]});
      }
    }
  }
  sort(inversion.begin(), inversion.end(), comparator);
  cout << inversion.size() << endl;
  for (int i = 0; i < inversion.size(); i++) {
    cout << inversion[i][0] + 1 << " " << inversion[i][1] + 1 << endl;
  }
  return 0;
}
