#include <bits/stdc++.h>
using namespace std;
int in() {
  int x;
  scanf("%d", &x);
  return x;
}
long long lin() {
  long long x;
  scanf("%lld", &x);
  return x;
}
int e[1010][1010];
int main() {
  int n;
  cin >> n;
  vector<int> d(n);
  for (int i = 0; i < n; ++i) cin >> d[i];
  int m = d.back() + 1;
  int x = 0;
  for (int l = 0, r = n - 1; l <= r; l++, r--) {
    for (int i = x; i <= d[l] - 1; ++i)
      for (int j = i + 1; j <= d[r]; ++j) e[i][j] = 1;
  }
  vector<pair<int, int> > ans;
  for (int i = 0; i < m; ++i)
    for (int j = i + 1; j <= m - 1; ++j)
      if (e[i][j]) ans.push_back(pair<int, int>(i, j));
  cout << ans.size() << endl;
  for (pair<int, int> p : ans)
    cout << p.first + 1 << " " << p.second + 1 << endl;
  return 0;
}
