#include <bits/stdc++.h>
using namespace std;
const int N = 310;
int d[N], n, t[N];
vector<pair<int, int> > ans;
void solve(int p) {
  if (p == 0) return;
  if (p == 1) {
    for (int i = 1; i <= d[p] + 1; ++i)
      for (int j = 1; j < i; ++j) ans.push_back(make_pair(i, j));
    return;
  }
  for (int i = d[p] - d[1] + 2; i <= d[p] + 1; ++i)
    for (int j = 1; j < i; ++j) ans.push_back(make_pair(i, j));
  for (int i = 1; i <= p - 2; ++i) t[i] = d[i + 1] - d[1];
  for (int i = 1; i <= p - 2; ++i) d[i] = t[i];
  solve(p - 2);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &d[i]);
  solve(n);
  printf("%d\n", (int)ans.size());
  for (int i = 0; i < (int)ans.size(); ++i)
    printf("%d %d\n", ans[i].first, ans[i].second);
  return 0;
}
