#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll MOD = 998244353;
const ll MAX = 2e5 + 1;
inline ll add(ll a, ll b) { return ((a % mod) + (b % mod)) % mod; }
inline ll sub(ll a, ll b) { return ((a % mod) - (b % mod) + mod) % mod; }
inline ll mul(ll a, ll b) { return ((a % mod) * (b % mod)) % mod; }
ll pwr(ll x, ll n) {
  if (!n) return 1;
  if (n & 1)
    return mul(x, pwr(mul(x, x), (n - 1) / 2));
  else
    return pwr(mul(x, x), n / 2);
}
ll modinv(ll n) { return pwr(n, mod - 2); }
void speed_solve() {
  ll n;
  cin >> n;
  ll a[n];
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<pair<ll, ll> > inv;
  for (ll i = 0; i < n; i++) {
    for (ll j = i + 1; j < n; j++) {
      if (a[j] < a[i]) {
        inv.push_back({i, j});
      }
    }
  }
  sort(inv.begin(), inv.end(), [&](pair<ll, ll> A, pair<ll, ll> B) {
    if (A.first == B.first) {
      if (a[A.second] == a[B.second]) {
        return A.second > B.second;
      }
      return a[A.second] > a[B.second];
    }
    return A.first < B.first;
  });
  cout << (ll)inv.size() << "\n";
  for (auto it : inv) {
    cout << it.first + 1 << " " << it.second + 1 << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ll test_cases = 1;
  for (ll i = 0; i < test_cases; i++) {
    speed_solve();
  }
  return 0;
}
