#include <bits/stdc++.h>
using namespace std;
int n, cnt;
vector<int> d;
vector<pair<int, int> > rua(vector<int> d) {
  if (d.empty()) {
    cnt++;
    return vector<pair<int, int> >();
  }
  if (d.size() < 2) {
    vector<pair<int, int> > res;
    for (int i = 1; i <= d[0] + 1; i++)
      for (int j = 1; j < i; j++) res.push_back(make_pair(i, j));
    cnt += d[0] + 1;
    return res;
  }
  int d0 = d[0], dd = d[d.size() - 1] - d[d.size() - 2];
  for (int i = 1; i < d.size(); i++) d[i] -= d[0];
  d.erase(d.begin()), d.pop_back();
  auto res = rua(d);
  for (int i = 1; i <= d0; i++)
    for (int j = 1; j < cnt + dd + i; j++)
      res.push_back(make_pair(cnt + dd + i, j));
  cnt += dd + d0;
  return res;
}
int main() {
  scanf("%d", &n);
  d.resize(n);
  for (int i = 0; i < n; i++) scanf("%d", &d[i]);
  auto ans = rua(d);
  printf("%d\n", (int)ans.size());
  for (auto i : ans) printf("%d %d\n", i.first, i.second);
  return 0;
}
