#include <bits/stdc++.h>
using namespace std;
const int N = 305, S = 1005;
int n, tab[N], wsk1, wsk2, m = 0;
vector<int> graf[S];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> tab[i];
  wsk1 = 0;
  wsk2 = tab[n] + 2;
  for (int i = 1; i <= (n + 1) / 2; i++) {
    if (i == n + 1 - i) {
      wsk2--;
      wsk1 = wsk2 - tab[i] + tab[i - 1];
      for (int j = wsk1; j < wsk2; j++) {
        for (int k = j + 1; k <= wsk2; k++) {
          m++;
          graf[j].push_back(k);
          graf[k].push_back(j);
        }
      }
    } else {
      wsk1 = tab[n] + 1 - tab[n - i + 1];
      while (wsk2 > tab[n] + 2 - tab[i]) {
        wsk2--;
        for (int j = wsk2 - 1; j >= wsk1; j--) {
          m++;
          graf[wsk2].push_back(j);
          graf[j].push_back(wsk2);
        }
      }
    }
  }
  cout << m << endl;
  for (int i = 1; i <= tab[n]; i++) {
    for (int j = 0; j < graf[i].size(); j++) {
      int v = graf[i][j];
      if (v > i) {
        cout << i << ' ' << v << endl;
      }
    }
  }
  return 0;
}
