#include <bits/stdc++.h>
const double Pi = acos(-1.0);
using namespace std;
int n;
int d[305];
vector<pair<int, int> > ans;
int main(int argc, char** argv) {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &d[i]);
  int a = 1;
  for (int i = 1; i <= (n + 1) / 2; i++) {
    int tot = d[n - i + 1] + 1;
    for (int j = 0; j < d[i] - d[i - 1]; j++) {
      for (int b = a + 1; b <= tot; b++) ans.push_back(pair<int, int>(a, b));
      a++;
    }
  }
  printf("%d\n", ans.size());
  for (int i = 0; i < (int)ans.size(); i++)
    printf("%d %d\n", ans[i].first, ans[i].second);
  return 0;
}
