#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int d[305];
  d[0] = 0;
  for (int i = 1; i <= n; i++) {
    cin >> d[i];
  }
  int j = n, k = 1, i = 0;
  vector<pair<int, int> > v;
  while (j >= k) {
    int l = i + d[k] - d[k - 1];
    for (; i < l; i++) {
      for (int m = i + 1; m <= d[j]; m++) v.push_back(pair<int, int>(i, m));
    }
    j--;
    k++;
  }
  cout << (int)v.size() << endl;
  for (pair<int, int> p : v) cout << p.first + 1 << " " << p.second + 1 << endl;
}
