#include <bits/stdc++.h>
using namespace std;
int main() {
  {
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    int squeeze[n];
    for (int i = 0; i < n; i++) squeeze[i] = i;
    sort(squeeze, squeeze + n, [&](int i, int j) {
      if (a[i] == a[j]) return i < j;
      return a[i] < a[j];
    });
    int b[n];
    for (int i = 0; i < n; i++) {
      b[squeeze[i]] = i;
    }
    vector<pair<int, int>> ans;
    for (int i = n - 1; i >= 0; i--) {
      if (b[i] == i) continue;
      int x = b[i] + 1;
      int st;
      for (int j = 0; j < i; j++) {
        if (b[j] == x) {
          st = j;
          break;
        }
      }
      ans.push_back({st + 1, i + 1});
      int z = b[i];
      b[i] = b[st];
      b[st] = z;
      i++;
    }
    cout << ans.size() << '\n';
    for (int i = 0; i < ans.size(); i++)
      cout << ans[i].first << ' ' << ans[i].second << '\n';
  }
  return 0;
}
