#include <bits/stdc++.h>
using namespace std;
int S[300 + 10];
struct E {
  int v1;
  int v2;
} edge[1000000 + 10];
int D[1000000 + 10];
int N;
int tot;
void init() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> S[i];
  }
  return;
}
void judge() {
  int i = 0;
  int j = N - 1;
  int l = 1;
  int r = S[N - 1] + 1;
  while (l < r) {
    for (int m = r - 1; m >= l; m--) {
      edge[tot].v1 = m;
      edge[tot].v2 = r;
      D[r]++;
      D[m]++;
      tot++;
    }
    r--;
    if (D[l] == S[i]) {
      i++;
      j--;
      l = r - (S[j] - D[r]);
    }
  }
  return;
}
void output() {
  cout << tot << endl;
  for (int i = 0; i < tot; i++) {
    printf("%d %d\n", edge[i].v1, edge[i].v2);
  }
  return;
}
int main() {
  init();
  judge();
  output();
  return 0;
}
