Little Robber Girl likes to scare animals in her zoo for fun. She decided to arrange the animals in a row in the order of non-decreasing height. However, the animals were so scared that they couldn't stay in the right places.

The robber girl was angry at first, but then she decided to arrange the animals herself. She repeatedly names numbers l and r such that r - l + 1 is even. After that animals that occupy positions between l and r inclusively are rearranged as follows: the animal at position l swaps places with the animal at position l + 1, the animal l + 2 swaps with the animal l + 3, ..., finally, the animal at position r - 1 swaps with the animal r.

Help the robber girl to arrange the animals in the order of non-decreasing height. You should name at most 20 000 segments, since otherwise the robber girl will become bored and will start scaring the animals again.

Input

The first line contains a single integer n (1 ≤ n ≤ 100) — number of animals in the robber girl's zoo.

The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109), where ai is the height of the animal occupying the i-th place.

Output

Print the sequence of operations that will rearrange the animals by non-decreasing height.

The output should contain several lines, i-th of the lines should contain two space-separated integers li and ri (1 ≤ li < ri ≤ n) — descriptions of segments the robber girl should name. The segments should be described in the order the operations are performed.

The number of operations should not exceed 20 000.

If the animals are arranged correctly from the start, you are allowed to output nothing.

Examples

Input

4
2 1 4 3


Output

1 4


Input

7
36 28 57 39 66 69 68


Output

1 4
6 7


Input

5
1 2 1 2 1


Output

2 5
3 4
1 4
1 4

Note

Note that you don't have to minimize the number of operations. Any solution that performs at most 20 000 operations is allowed.
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const int INF = 1000001000;
const long long INFLL = INF * 1LL * INF;
const int mod = 1000 * 1000 * 1000 + 7;
const int mod9 = 1000 * 1000 * 1000 + 9;
const int modr = 99990001;
const long double PI = 3.1415926535897932385;
template <class T>
void zero(T val, T& first) {
  first = val;
}
template <class T, class... Targs>
void zero(T val, T& first, Targs&... Fargs) {
  first = val;
  zero(val, Fargs...);
}
template <class T, class T2>
std::istream& operator>>(std::istream& is, pair<T, T2>& p) {
  return is >> p.first >> p.second;
}
template <class T>
std::istream& readN(T& first, int n, int st = 0) {
  for (int i = st, iend = (st + n - 1); i <= iend; i++) cin >> first[i];
  return cin;
}
template <class T>
std::istream& readS(set<T>& first, int n) {
  T second = *first.rbegin();
  for (int i = 0, iend = (n - 1); i <= iend; i++) {
    cin >> second;
    first.insert(second);
  }
  return cin;
}
template <class T>
std::istream& read(T& first) {
  return cin >> first;
}
template <class T, class... Targs>
std::istream& read(T& first, Targs&... Fargs) {
  return read(first), read(Fargs...);
}
template <class T, class T2>
std::ostream& operator<<(std::ostream& os, pair<T, T2> p) {
  return os << p.first << " " << p.second;
}
template <class T>
std::ostream& operator<<(std::ostream& os, vector<T> v) {
  bool f = true;
  for (auto second : v) {
    if (!f) os << ' ';
    os << second;
    f = false;
  }
  return os;
}
template <class T>
std::ostream& operator<<(std::ostream& os, set<T> v) {
  bool f = true;
  for (auto second : v) {
    if (!f) os << ' ';
    os << second;
    f = false;
  }
  return os;
}
template <class T>
std::ostream& operator<<(std::ostream& os, multiset<T> v) {
  bool f = true;
  for (auto second : v) {
    if (!f) os << ' ';
    os << second;
    f = false;
  }
  return os;
}
template <class T, class T2>
std::ostream& operator<<(std::ostream& os, map<T, T2> v) {
  bool f = true;
  for (pair<T, T2> second : v) {
    if (!f) os << ' ';
    os << second.first << '=>' << second.second;
    f = false;
  }
  return os;
}
template <class T>
std::ostream& outV(T first, char del = ' ') {
  bool f = true;
  for (auto second : first) {
    if (!f) cout << del;
    cout << second;
    f = false;
  }
  return cout;
}
template <class T>
std::ostream& outN(T first, int n = -1, int st = 0) {
  for (int i = st, iend = (n == -1 ? (int)first.size() - 1 : st + n - 1);
       i <= iend; i++) {
    cout << first[i];
    if (i < iend) cout << ' ';
  }
  return cout;
}
template <class T>
std::ostream& outAN(T first, int n = -1, int st = 0) {
  for (int i = st, iend = (n - 1); i <= iend; i++) {
    cout << first[i];
    if (i < iend) cout << ' ';
  }
  return cout;
}
template <class T>
std::ostream& out(T first) {
  return cout << first;
}
template <class T, class... Targs>
std::ostream& out(T first, Targs... Fargs) {
  return out(first) << " ", out(Fargs...);
}
template <typename T>
void srt(T& a, int st, int fn, bool isArr) {
  sort(a + st, a + fn + 1);
}
template <class T>
void srt(T& a, int st = 0, int fn = 0) {
  sort(a.begin() + st, fn ? a.begin() + fn + 1 : a.end());
}
template <typename T>
T rev_num(T a) {
  T r = 0;
  for (; a; a /= 10) r = r * 10 + a % 10;
  return r;
}
template <typename T>
void rev(T& a, int st, int fn, bool isArr) {
  reverse(a + st, a + fn + 1);
}
template <class T>
void rev(T& a, int st = 0, int fn = 0) {
  reverse(a.begin() + st, fn ? a.begin() + fn + 1 : a.end());
}
long long phi(int n) {
  int res = n;
  for (long long i = 2; i * i <= n; i++)
    if (n % i == 0) {
      while (n % i == 0) n /= i;
      res -= res / i;
    }
  if (n > 1) res -= res / n;
  return res;
}
long long bpm(long long a, long long n = -2, long long m = mod) {
  n = n < 0 ? n + m : n;
  long long r = 1;
  while (n) {
    if (n & 1) r = (r * a) % m;
    a = (a * a) % m;
    n >>= 1;
  }
  return r;
}
unsigned long long gcd(unsigned long long a, unsigned long long b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
vector<int> ero_p, ero_l;
void ero(int n) {
  ero_l.resize(n + 1);
  ero_l[0] = -1;
  for (int i = 2, iend = (n); i <= iend; i++)
    if (!ero_l[i]) {
      ero_p.push_back(i);
      ero_l[i] = i;
      for (long long j = i * 1LL * i; j <= n; j += i) {
        ero_l[j] = i;
      }
    }
}
long long gcd_cb(long long a, long long b, long long& first,
                 long long& second) {
  if (!b) {
    first = 1;
    second = 0;
    return a;
  }
  long long x1, y1, g;
  g = gcd_cb(b, a % b, x1, y1);
  first = y1;
  second = x1 - a / b * y1;
  return g;
}
vector<long long> fact;
void fact_prec(int n = 20) {
  fact.resize(n + 1);
  fact[0] = 1;
  for (int i = 1, iend = (n); i <= iend; i++) {
    fact[i] = fact[i - 1] * i;
  }
}
vector<long double> factd;
void fact_precd(int n = 146) {
  factd.resize(n + 1);
  factd[0] = 1;
  for (int i = 1, iend = (n); i <= iend; i++) {
    factd[i] = factd[i - 1] * i;
  }
}
string str(long long a) {
  string r = "";
  for (; a; a /= 10) r += a % 10 + '0';
  rev(r);
  return r;
}
const int N = 400005;
long long a[N], b[N];
pair<long long, long long> p[N], p2[N];
int main() {
  int n;
  read(n);
  for (int i = 0, iend = (n - 1); i <= iend; i++) {
    int first;
    read(first);
    p2[i] = p[i] = {first, i};
  }
  sort(p2, p2 + n);
  for (int i = 0, iend = (n - 1); i <= iend; i++) {
    p[p2[i].second].second = i;
  }
  int l = 0, r = n - 1;
  while (true) {
    while (r >= 0 && p[r].second == r) {
      r--;
    }
    while (l < n && p[l].second == l) {
      l++;
    }
    if (l > r) break;
    int mn = l;
    for (int j = l, jend = (r); j <= jend; j++) {
      if (p[mn].second > p[j].second) {
        mn = j;
      }
    }
    out(mn, mn + 1) << "\n";
    swap(p[mn - 1], p[mn]);
  }
  return 0;
}
