#include <bits/stdc++.h>
using namespace std;
int a[302];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  stack<pair<int, int> > stk;
  for (int l = 1, r = n; l <= r; l++, r--) {
    if (l == r) {
      stk.push(pair<int, int>(0, a[l] - a[l - 1] + 1));
    } else {
      stk.push(pair<int, int>(a[r] - a[r - 1], a[l] - a[l - 1]));
      if (l + 1 == r) stk.push(pair<int, int>(1, 0));
    }
  }
  int id = 0;
  vector<pair<int, int> > vec;
  while (!stk.empty()) {
    pair<int, int> p = stk.top();
    stk.pop();
    id += p.first;
    for (int i = id + 1; i <= id + p.second; i++) {
      for (int j = 1; j < i; j++) {
        if (i != j) vec.push_back(pair<int, int>(i, j));
      }
    }
    id += p.second;
  }
  printf("%d\n", vec.size());
  for (auto p : vec) {
    printf("%d %d\n", p.first, p.second);
  }
}
