#include <bits/stdc++.h>
int main() {
  static int dd[300], ii[1000000], jj[1000000];
  int k, n, m, c, h, i, j;
  scanf("%d", &k);
  for (i = 0; i < k; i++) scanf("%d", &dd[i]);
  m = 0;
  while (k > 0) {
    n = dd[k - 1] + 1;
    c = dd[0];
    for (j = n - c; j < n; j++)
      for (i = 0; i < j; i++) {
        ii[m] = i;
        jj[m] = j;
        m++;
      }
    for (h = 1; h < k - 1; h++) dd[h - 1] = dd[h] - c;
    k -= 2;
  }
  printf("%d\n", m);
  for (h = 0; h < m; h++) printf("%d %d\n", ii[h] + 1, jj[h] + 1);
  return 0;
}
