#include <bits/stdc++.h>
using namespace std;
const int NMAX = 300;
const int VMAX = 1e3;
const int MMAX = 1e6;
int n, m;
int st, dr;
int v[1 + NMAX];
bitset<1 + VMAX> f;
pair<int, int> sol[1 + MMAX];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
    f[v[i]] = 1;
  }
  while (v[n] > dr) {
    do {
      for (int i = st + 2; i <= v[n] + 1; i++) sol[++m] = {st + 1, i};
      st++;
      dr++;
    } while (!f[dr]);
    n--;
  }
  cout << m << "\n";
  for (int i = 1; i <= m; i++)
    cout << sol[i].first << " " << sol[i].second << "\n";
  return 0;
}
