#include <bits/stdc++.h>
using namespace std;
int d[310];
vector<pair<int, int> > ans;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", d + i);
  int l = 1, r = d[n] + 1;
  for (int k = 1; k <= n / 2; k++) {
    int limt = l + d[k];
    for (int u = l; u < limt; u++, l++) {
      for (int v = u + 1; v <= r; v++) ans.push_back(pair<int, int>(u, v));
    }
    for (int i = 0; i < d[n - k + 1] - d[n - k]; i++) r--;
    for (int i = k + 1; i <= n - k; i++) d[i] -= d[k];
  }
  if (n & 1) {
    for (int u = l; u <= r; u++)
      for (int v = u + 1; v <= r; v++) ans.push_back(pair<int, int>(u, v));
  }
  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;
}
