#include <bits/stdc++.h>
using namespace std;
int d[309], cnt;
int main() {
  int n;
  cin >> n;
  vector<int> a, b;
  for (int i = 1; i <= n; i++) cin >> d[i];
  int m = d[n] + 1;
  int l = 1, r = n, f = 0;
  int i;
  for (i = 1; i <= m && l <= r; i++) {
    if (m - i + cnt == d[r]) {
      for (int j = i + 1; j <= m; j++) {
        a.push_back(i);
        b.push_back(j);
      }
      cnt++;
      r--;
      f = 1;
    } else if (cnt == d[l]) {
      l++;
      f = 0;
    } else {
      if (f) {
        for (int j = i + 1; j <= m; j++) {
          a.push_back(i);
          b.push_back(j);
        }
        cnt++;
      }
    }
  }
  if (f) {
    for (; i <= m; i++) {
      for (int j = i + 1; j <= m; j++) {
        a.push_back(i);
        b.push_back(j);
      }
    }
  }
  cout << a.size() << endl;
  for (int i = 0; i < a.size(); i++) {
    cout << a[i] << " " << b[i] << endl;
  }
  return 0;
}
