#include <bits/stdc++.h>
using namespace std;
void omajinai() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(15);
}
int n;
long *a, *b;
map<long, long> m;
int main() {
  omajinai();
  cin >> n;
  a = new long[n + 1];
  b = new long[n + 1];
  for_each(a + 1, a + n + 1, [](long &n) { cin >> n; });
  copy(a, a + n + 1, b);
  sort(b + 1, b + n + 1);
  int s = 1, e = n;
  while (true) {
    while (e >= 1 && b[e] == a[e]) e--;
    while (s <= n && b[s] == a[s]) s++;
    if (e - s <= 0) break;
    int cho = 0;
    int cho2 = 0;
    while (a[s + 1 + cho2] != b[s]) cho2++;
    if ((e - (s + cho2) + 1) % 2 != 0) {
      cho = 1;
      while (a[e - cho] > a[e - cho - 1]) cho += 2;
    }
    cout << s + cho2 << " " << e - cho << endl;
    swap(a[s + cho2], a[s + 1 + cho2]);
    if (s + cho2 + 1 != e - cho) swap(a[e - cho], a[e - cho - 1]);
    if (e - cho - s - cho2 > 4) {
      cout << s + cho2 + 2 << " " << e - cho - 2 << endl;
    }
  }
}
