#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > ans;
void work(vector<int> d) {
  if (d.size() == 0) return;
  if (d.size() == 1) {
    for (int i = 1; i < d[0] + 1; i++) {
      for (int j = i + 1; j <= d[0] + 1; j++) {
        ans.push_back({i, j});
      }
    }
  } else {
    vector<int> dd;
    for (int i = 1; i < d.size() - 1; i++) dd.push_back(d[i] - d[0]);
    work(dd);
    for (int i = d.back() + 1; i > d.back() - d[0] + 1; i--) {
      for (int j = 1; j < i; j++) {
        ans.push_back({i, j});
      }
    }
  }
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<int> d(n);
  for (int i = 0; i < n; i++) cin >> d[i];
  work(d);
  cout << ans.size() << endl;
  for (auto p : ans) cout << p.first << ' ' << p.second << endl;
  return 0;
}
