#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  x = 0;
  int f = 1;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') {
    f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
int i, j, k, m, n, s, t;
const int N = 310, M = 1e4 + 10, MN = 1e6 + 10;
int d[N], cnt[N], deg[M], u[MN], v[MN], p[M];
bool cmp(int aa, int bb) { return aa > bb; }
signed main() {
  read(n);
  for (i = 1; i <= n; i++) read(d[i]);
  int r = d[n] + 1, ans = 0, l = 1;
  for (int tt = 1; tt <= n / 2; tt++) {
    for (i = r; i >= r - (d[tt] - d[tt - 1]) + 1; i--)
      for (j = i - 1; j >= l; j--) ans++, u[ans] = i, v[ans] = j;
    l = l + d[n - tt + 1] - d[n - tt];
    r = i;
  }
  for (i = r; i >= l; i--)
    for (j = i - 1; j >= l; j--) ++ans, u[ans] = i, v[ans] = j;
  printf("%d\n", ans);
  for (i = 1; i <= ans; i++) printf("%d %d\n", u[i], v[i]);
  return 0;
}
