#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
ll mod = 1000000007;
const int INF = 1e9;
const ll LINF = 1e18;
ll mod_sum() { return 0LL; }
template <typename T, typename... Args>
T mod_sum(T a, Args... args) {
  return ((a + mod_sum(args...)) % mod + mod) % mod;
}
ll mod_prod() { return 1LL; }
template <typename T, typename... Args>
T mod_prod(T a, Args... args) {
  return (a * mod_prod(args...)) % mod;
}
using pii = pair<ll, ll>;
using vi = vector<ll>;
using vb = vector<bool>;
using vvi = vector<vector<ll> >;
using vvb = vector<vector<bool> >;
using vpii = vector<pii>;
using vvpii = vector<vector<pii> >;
bool cmpsecond(pii a, pii b) { return a.second < b.second; }
ll solve() {
  ll n;
  cin >> n;
  vpii mp(n);
  for (ll i = 0; i < n; i++) {
    cin >> mp[i].first;
    mp[i].second = i;
  }
  sort((mp).begin(), (mp).end());
  for (ll i = 0; i < n; i++) mp[i].first = i;
  sort((mp).begin(), (mp).end(), cmpsecond);
  vi vec(n);
  for (ll i = 0; i < n; i++) vec[i] = mp[i].first;
  vi ind(n);
  for (ll i = 0; i < n; i++) ind[vec[i]] = i;
  vpii ans;
  for (ll i = n - 1; i >= 0; i--) {
    ll x = vec[i];
    for (ll j = x + 1; j <= i; j++) {
      ll p = i, q = ind[j];
      ans.push_back({q, p});
      swap(vec[p], vec[q]);
      ind[vec[p]] = p, ind[vec[q]] = q;
    }
  }
  cout << ans.size() << '\n';
  for (auto &p : ans) cout << ++p.first << " " << ++p.second << '\n';
  return 0;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ll t = 1;
  while (t--) solve();
  return 0;
}
