#include <bits/stdc++.h>
using namespace std;
const int64_t M1 = 998244353;
const int64_t M2 = 1000000007;
vector<int64_t> a;
bool comp(int64_t i, int64_t j) {
  if (a[i] != a[j]) return a[i] < a[j];
  return i < j;
}
void solve() {
  int64_t n;
  cin >> n;
  a.resize(n);
  vector<int64_t> b(n);
  vector<pair<int64_t, int64_t>> ans;
  for (int64_t &x : a) cin >> x;
  iota(b.begin(), b.end(), 0);
  sort(b.begin(), b.end(), comp);
  for (int64_t i = 0; i < n; i++) {
    for (int64_t j = 0; j + 1 < n; j++) {
      if (b[j] > b[j + 1]) {
        ans.push_back({b[j + 1], b[j]});
        swap(b[j + 1], b[j]);
      }
    }
  }
  cout << ans.size() << "\n";
  for (auto &x : ans) cout << x.first + 1 << " " << x.second + 1 << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
}
