#include <bits/stdc++.h>
inline int read() {
  int f = 1, id = 0;
  char ch = getchar();
  while (!(ch >= '0' && ch <= '9')) {
    if (ch == '-') f *= -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    id = id * 10 + ch - '0';
    ch = getchar();
  }
  return f * id;
}
struct Node {
  int id, d;
} a[200000 + 1];
bool cmp(Node n1, Node n2) { return n1.d > n2.d; }
int n, len, pos, id[200000 + 1], num[200000 + 1], map[200000 + 1];
std::vector<int> list[200000 + 1];
int main() {
  n = read();
  for (int i = 1; i <= n; i++) a[i].d = read(), a[i].id = i;
  std::sort(a + 1, a + 1 + n, cmp);
  for (int i = 1; i < n; i++) {
    num[i] = a[i].id * 2;
    map[num[i]] = a[i + 1].id * 2;
  }
  num[n] = a[n].id * 2;
  len = n, pos = n;
  for (int i = 1; i <= n; i++) {
    if (a[i].d == pos)
      map[num[len++]] = (a[i].id * 2) - 1, num[len] = (a[i].id * 2) - 1;
    else {
      pos--;
      list[num[i + a[i].d - 1]].push_back((a[i].id * 2) - 1);
    }
  }
  for (int i = 1; i < len; i++) printf("%d %d\n", num[i], map[num[i]]);
  for (int i = 1; i <= len; i++)
    for (int j = 0; j < list[num[i]].size(); j++)
      printf("%d %d\n", num[i], list[num[i]][j]);
}
