#include <bits/stdc++.h>
using namespace std;
const long long inf = INT_MAX, df = 1005;
struct node {
  long long fir, sec;
};
vector<node> ans;
long long i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, pos[df], a[df],
    b[df], c[df], cnt, tot;
inline long long read() {
  long long x = 0, y = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') y = (ch == '-') ? -1 : 1, ch = getchar();
  while (ch >= '0' && ch <= '9')
    x = (x << 3) + (x << 1) + ch - '0', ch = getchar();
  return x * y;
}
void upd(long long x, long long y) {
  pos[a[x]] = y;
  pos[a[y]] = x;
  swap(a[x], a[y]);
  ans.push_back((node){x, y});
}
int main() {
  n = read();
  for (long long i = (1); i <= (n); ++i) a[i] = c[i] = read();
  sort(c + 1, c + n + 1);
  cnt = unique(c + 1, c + n + 1) - c - 1;
  for (long long i = (1); i <= (cnt); ++i)
    for (long long j = (1); j <= (n); ++j)
      if (a[j] == c[i]) b[j] = ++tot;
  for (long long i = (1); i <= (n); ++i) a[i] = b[i];
  for (long long i = (1); i <= (n); ++i) pos[a[i]] = i;
  for (long long i = (n); i >= (1); --i) {
    for (long long j = (a[i] + 1); j <= (i); ++j) {
      upd(pos[j], i);
    }
  }
  long long ty = ans.size();
  printf("%lld\n", ty);
  if (!ty) return 0;
  for (long long i = (0); i <= (ty - 1); ++i)
    printf("%lld %lld\n", ans[i].fir, ans[i].sec);
}
