#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i <= n - 1; i++) cin >> arr[i];
  vector<pair<int, int> > G[n];
  int cnt = 0;
  for (int i = 0; i <= n - 1; i++) {
    for (int j = i + 1; j <= n - 1; j++) {
      if (arr[i] > arr[j]) {
        G[i].push_back(make_pair(arr[j], j));
        cnt++;
      }
    }
  }
  cout << cnt << '\n';
  for (int i = 0; i <= n - 1; i++) {
    sort(G[i].begin(), G[i].end());
    int s = G[i].size();
    for (int j = s - 1; j >= 0; j--) {
      cout << i + 1 << " " << G[i][j].second + 1 << '\n';
    }
  }
  return 0;
}
