#include <bits/stdc++.h>
int n, m, cnt[1005], Delta;
std::vector<std::pair<int, int> > ans;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &cnt[i]);
  m = cnt[n] + 1;
  int l = 1, r = n;
  while (l < r) {
    for (int i = 1; i <= cnt[l]; i++)
      for (int j = 1; j <= cnt[r] + 1 - i; j++)
        ans.push_back({i + Delta, i + j + Delta});
    Delta += cnt[l];
    for (int i = l + 1; i < r; i++) cnt[i] -= cnt[l];
    l++, r--;
  }
  if (l == r) {
    for (int i = 1; i <= cnt[l]; i++)
      for (int j = 1; j <= cnt[r] + 1 - i; j++)
        ans.push_back({i + Delta, i + j + Delta});
  }
  printf("%d\n", ans.size());
  for (auto v : ans) printf("%d %d\n", v.first, v.second);
}
