#include <bits/stdc++.h>
using namespace std;
static inline void canhazfast() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
}
template <typename T>
T gcd(T a, T b) {
  return b == 0 ? a : gcd(b, a % b);
}
template <typename T>
T extgcd(T a, T b, T &x, T &y) {
  T x0 = 1, y0 = 0, x1 = 0, y1 = 1;
  while (b) {
    T q = a / b;
    a %= b;
    swap(a, b);
    x0 -= q * x1;
    swap(x0, x1);
    y0 -= q * y1;
    swap(y0, y1);
  }
  x = x0;
  y = y0;
  return a;
}
static inline int ctz(unsigned x) { return __builtin_ctz(x); }
static inline int ctzll(unsigned long long x) { return __builtin_ctzll(x); }
static inline int clz(unsigned x) { return __builtin_clz(x); }
static inline int clzll(unsigned long long x) { return __builtin_clzll(x); }
int d[512];
bool a[1024][1024];
vector<pair<int, int> > ans;
void calc(int l, int r) {
  if (l > r) return;
  if (l == r) {
    for (int i = 0; i <= d[l]; ++i) {
      for (int j = 0; j < i; ++j) a[i][j] = 1, ans.emplace_back(i, j);
    }
    return;
  }
  for (int i = l + 1; i < r; ++i) d[i] -= d[l];
  calc(l + 1, r - 1);
  for (int i = d[r] - d[l] + 1; i <= d[r]; ++i) {
    for (int j = 0; j < i; ++j) a[i][j] = 1, ans.emplace_back(i, j);
  }
}
int main() {
  canhazfast();
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> d[i];
  calc(0, n - 1);
  cout << ans.size() << '\n';
  for (pair<int, int> e : ans)
    cout << e.first + 1 << ' ' << e.second + 1 << '\n';
  return 0;
}
