#include <bits/stdc++.h>
using namespace std;
const int maxn = 300 + 7;
int n, a[maxn];
vector<pair<int, int> > vec;
void solve(int l_, int r_, int l, int r, int cnt) {
  if (l > r || (l == r && r_ - l_ < a[l] - cnt)) return;
  int t = a[l] - cnt;
  for (int i = 0; i < t; ++i) {
    int tt = r_ - i;
    for (int j = l_; j < tt; ++j) {
      vec.push_back(make_pair(j, tt));
    }
  }
  solve(l_ + 1, l_ + a[r - 1] - cnt - t + 1, l + 1, r - 1, cnt + t);
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  solve(1, a[n] + 1, 1, n, 0);
  cout << vec.size() << endl;
  for (auto i : vec) {
    cout << i.first << ' ' << i.second << endl;
  }
  return 0;
}
