#include <bits/stdc++.h>
using namespace std;
int a[303], b[303], n;
bool v[1004][1004];
void construct(int s, int e) {
  if (e - s >= 3) {
    for (int i = a[e - 1] + 2 - a[s]; i <= a[e - 1] + 1; ++i) {
      for (int j = 1; j <= a[e - 1] + 1; j++) v[i][j] = 1;
    }
    for (int i = s + 1; i < e; ++i) a[i] = a[i] - a[s];
    construct(s + 1, e - 1);
  } else if (e - s == 2) {
    for (int i = a[e - 1] + 2 - a[s]; i <= a[e - 1] + 1; ++i) {
      for (int j = 1; j <= a[e - 1] + 1; j++) v[i][j] = 1;
    }
  } else if (e - s == 1) {
    for (int i = 1; i <= a[s] + 1; ++i) {
      for (int j = 1; j <= a[s] + 1; ++j) v[i][j] = 1;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  construct(1, n + 1);
  int t = 0;
  for (int i = 1; i <= b[n] + 1; ++i) {
    for (int j = 1; j < i; ++j) {
      if (i != j && v[i][j] == 1) t++;
    }
  }
  cout << t << endl;
  for (int i = 1; i <= b[n] + 1; ++i) {
    for (int j = 1; j < i; ++j) {
      if (i != j && v[i][j] == 1) cout << i << " " << j << endl;
    }
  }
}
