#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int d[1010];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> d[i];
  vector<vector<int> > G(d[n - 1] + 1);
  int l = 0, m = 0;
  for (int i = 0, j = n - 1; i <= j; i++, j--) {
    for (int k = 0; k < d[i]; k++)
      for (int t = l; t <= l + d[j]; t++)
        if (t > k + l) {
          m++;
          G[t].push_back(k + l);
          G[k + l].push_back(t);
        }
    l += d[i] + 1;
    for (int k = j; k >= i; k--) d[k] -= d[i];
  }
  cout << m << endl;
  for (int i = 0; i < G.size(); i++)
    for (int j = 0; j < G[i].size(); j++)
      if (i < G[i][j]) cout << i + 1 << ' ' << G[i][j] + 1 << endl;
  return 0;
}
