#include <iostream>
#include <vector>

using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  for (int i = 0; i < n; i++)
    scanf("%d", &a[i]);
  vector<int> saveA = a;
  int kol = 0;
  for (int i = 0; i < n; i++) 
    for (int j = 0; j < n; j++)
      if (a[j] > a[i])
        swap(a[j], a[i]), kol++;
  printf("%d\n", kol);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      if (saveA[j] > saveA[i])
        swap(saveA[j], saveA[i]), printf("%d %d\n", i + 1, j + 1);  
}
