#include <bits/stdc++.h>
using namespace std;
int d[305];
bool G[1050][1050];
vector<pair<int, int> > V;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d", &d[i]);
  int st = 1, en = d[n] + 1;
  int sti = 1, eni = n;
  while (1) {
    if (sti == eni) {
      for (int i = st; i <= en; i++)
        for (int j = i + 1; j <= en; j++) G[i][j] = true;
      break;
    }
    if (sti + 1 == eni) {
      for (int i = st; i < st + d[sti]; i++)
        for (int j = st; j <= en; j++) G[i][j] = true;
      break;
    }
    for (int i = sti + 1; i <= eni - 1; i++) d[i] -= d[sti];
    for (int i = st; i < st + d[sti]; i++)
      for (int j = st; j <= en; j++) G[i][j] = true;
    st = st + d[sti];
    en = st + d[eni - 1];
    sti++;
    eni--;
  }
  for (int i = 1; i <= d[n] + 1; i++)
    for (int j = i + 1; j <= d[n] + 1; j++)
      if (G[i][j] || G[j][i]) V.push_back(make_pair(i, j));
  cout << V.size() << endl;
  for (int i = 0; i < V.size(); i++) {
    pair<int, int> t = V[i];
    cout << t.first << " " << t.second << endl;
  }
  return 0;
}
