#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
vector<int> arr;
int n;
bool con[N][N];
void solve(vector<int> &arr, int n) {
  if ((int)arr.size() == 0) return;
  if ((int)arr.size() == 1) {
    int cur = arr[0];
    for (int i = n; i >= n - cur; i--) {
      for (int j = i - 1; j >= n - cur; j--) {
        con[i][j] = con[j][i] = true;
      }
    }
    return;
  }
  int cur = arr.back();
  int frq = arr[0];
  for (int i = n; i > n - frq; i--) {
    for (int j = i - 1; j >= n - cur; j--) {
      con[i][j] = con[j][i] = true;
    }
  }
  for (int i = 0; i < (int)arr.size(); i++) {
    arr[i] -= frq;
  }
  arr.erase(arr.begin());
  arr.erase(arr.end() - 1);
  solve(arr, n - frq);
}
int main() {
  scanf("%d", &n);
  arr.resize(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
  }
  n = arr.back() + 1;
  solve(arr, arr.back() + 1);
  vector<pair<int, int> > ans;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (con[i][j]) ans.push_back(make_pair(i, j));
    }
  }
  printf("%d\n", (int)ans.size());
  for (int i = 0; i < (int)ans.size(); i++) {
    printf("%d %d\n", n - ans[i].first + 1, n - ans[i].second + 1);
  }
  return 0;
}
