#include <bits/stdc++.h>
const int M = 1e6 + 5;
int n, d[305], u[M], v[M], nd, du[1005], m, sum;
inline void push(int a, int b) {
  u[++m] = a;
  v[m] = b;
}
inline void solve() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &d[i]);
  for (int i = 1; i <= n; i++) {
    if (i > (n - i + 1)) break;
    for (int a = d[i - 1] + 1; a <= d[i]; a++)
      for (int b = a + 1; b <= d[n - i + 1] + 1; b++) push(a, b);
  }
  printf("%d\n", m);
  for (int i = 1; i <= m; i++) printf("%d %d\n", u[i], v[i]);
}
int main() { solve(); }
