#include <bits/stdc++.h>
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);
  int n;
  std::cin >> n;
  std::vector<int> A(n);
  for (int i = 0; i < (n); ++i) std::cin >> A[i];
  std::vector<std::pair<int, int> > ans;
  for (int i = 0; i < (n); ++i) {
    std::vector<std::pair<int, int> > heh;
    for (int j = (i + 1); j < (n); ++j) {
      if (A[i] > A[j]) {
        heh.push_back(std::make_pair(A[j], j));
      }
    }
    std::sort(heh.begin(), heh.end());
    std::reverse(heh.begin(), heh.end());
    for (auto& k : (heh)) {
      ans.push_back(std::make_pair(i, k.second));
    }
  }
  std::cout << ((int)(ans).size()) << "\n";
  for (auto& i : (ans)) std::cout << i.first + 1 << " " << i.second + 1 << "\n";
  return 0;
}
