#include <bits/stdc++.h>
using namespace std;
template <typename T>
void dbg(T a) {}
template <typename T, typename... Arg>
void dbg(T a, Arg... arg) {}
const int maxn = (3e3) + 7;
const int inf = (1e9) + 7;
const long long LLinf = (1e18) + 7;
const long double eps = 1e-9;
const long long mod = 1e9 + 7;
int d[maxn];
vector<pair<int, int> > kraw;
int cur = 0;
void rob(vector<int>& V) {
  if (((int)(V).size()) == 0) {
    cur++;
    return;
  }
  if (((int)(V).size()) == 1) {
    for (int i = cur; i <= V[0] + cur; i++)
      for (int j = i + 1; j <= V[0] + cur; j++) kraw.push_back({i, j});
    cur += V[0] + 1;
    return;
  }
  vector<int> D;
  for (int i = 0; i < ((int)(V).size()) - 2; i++) D.push_back(V[i + 1] - V[0]);
  rob(D);
  for (int i = 0; i < V.back() - V[((int)(V).size()) - 2]; i++) cur++;
  int st = cur;
  for (int i = 0; i < V[0]; i++) {
    for (int j = 0; j < cur; j++) kraw.push_back({cur, j});
    cur++;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int cur = 0;
  int res = 0;
  vector<int> V;
  for (int i = 0; i < n; i++) {
    int d;
    cin >> d;
    V.push_back(d);
  }
  rob(V);
  printf("%d\n", ((int)(kraw).size()));
  for (auto s : kraw) printf("%d %d\n", s.first + 1, s.second + 1);
  return 0;
}
