#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const int mod = 1000000007;
const int inf = 0x3fffffff;
const string imp = "IMPOSSIBLE";
const long long long_inf = 1LL << 60;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int sgn(int x) { return x == 0 ? 0 : (x > 0 ? 1 : -1); }
const int N = 1000010;
int cnt;
int x[N], y[N];
void calc(vector<int> d) {
  if (d.size() == 0) return;
  if (d.size() == 1) {
    for (int i = 1; i <= d.back() + 1; i++) {
      for (int j = i + 1; j <= d.back() + 1; j++) {
        x[cnt] = i;
        y[cnt] = j;
        cnt++;
      }
    }
    return;
  }
  vector<int> nd;
  for (int i = 1; i < d.size() - 1; i++) {
    nd.push_back(d[i] - d[0]);
  }
  int partA = nd.size() ? nd.back() + 1 : 1;
  int partB = d[d.size() - 1] - d[d.size() - 2];
  int partC = d[0];
  calc(nd);
  for (int i = 1; i <= partA; i++) {
    for (int j = 1; j <= partC; j++) {
      x[cnt] = i;
      y[cnt] = partA + partB + j;
      cnt++;
    }
  }
  for (int i = 1; i <= partB; i++) {
    for (int j = 1; j <= partC; j++) {
      x[cnt] = partA + i;
      y[cnt] = partA + partB + j;
      cnt++;
    }
  }
  for (int i = 1; i <= partC; i++) {
    for (int j = i + 1; j <= partC; j++) {
      x[cnt] = partA + partB + i;
      y[cnt] = partA + partB + j;
      cnt++;
    }
  }
}
void solve(int ncase) {
  int n;
  cin >> n;
  vector<int> d(n);
  for (int i = 0; i < n; i++) {
    cin >> d[i];
  }
  calc(d);
  printf("%d\n", cnt);
  for (int i = 0; i < cnt; i++) {
    printf("%d %d\n", x[i], y[i]);
  }
}
int main() {
  ios::sync_with_stdio(false);
  int T = 1;
  int ncase = 0;
  while (T--) {
    solve(++ncase);
  }
}
