#include <bits/stdc++.h>
using namespace std;
const int maxn = 310;
const int maxm = 1010;
int n, d[maxn], m;
bool fil[maxm][maxm];
int l, r, s;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &d[i]);
  m = d[n] + 1;
  l = 1;
  r = m;
  for (int i = 1; i <= n / 2; i++) {
    for (int j = i + 1; j <= n - i; j++) d[j] -= d[i];
    for (int j = l; j <= l + d[i] - 1; j++) {
      for (int k = l; k <= r; k++) fil[j][k] = true;
    }
    l = l + d[i];
    r = l + d[n - i];
  }
  if (n & 1) {
    for (int i = l; i <= r; i++)
      for (int j = l; j <= r; j++) fil[i][j] = true;
  }
  for (int i = 1; i <= m; i++)
    for (int j = i + 1; j <= m; j++)
      if (fil[i][j]) s++;
  printf("%d\n", s);
  for (int i = 1; i <= m; i++)
    for (int j = i + 1; j <= m; j++)
      if (fil[i][j]) printf("%d %d\n", i, j);
  return 0;
}
