#include <bits/stdc++.h>
using namespace std;
template <typename T>
string tos(T a) {
  stringstream ss;
  string ret;
  ss << a;
  ss >> ret;
  return ret;
}
void read(int &_a) { int temp = scanf("%d", &_a); }
void read(int &_a, int &_b) { int temp = scanf("%d %d", &_a, &_b); }
void read(int &_a, int &_b, int &_c) {
  int temp = scanf("%d %d %d", &_a, &_b, &_c);
}
int D[500];
std::vector<pair<int, int> > build(int st, int l, int r) {
  if (l > r) return vector<pair<int, int> >();
  vector<pair<int, int> > ret;
  int first = D[l];
  int n = D[r];
  for (int(i) = (0); (i) < (first); (i)++)
    for (int(j) = (i + 1); (j) < (n + 1); (j)++)
      ret.push_back(make_pair(i + st, j + st));
  for (int(i) = (l); (i) < (r + 1); (i)++) D[i] -= first;
  vector<pair<int, int> > nxt = build(st + first, l + 1, r - 1);
  ret.insert(ret.end(), nxt.begin(), nxt.end());
  return ret;
}
int main() {
  int n;
  while (cin >> n) {
    for (int(i) = (0); (i) < (n); (i)++) read(D[i]);
    vector<pair<int, int> > v = build(0, 0, n - 1);
    cout << v.size() << endl;
    for (int(i) = (0); (i) < (v.size()); (i)++)
      cout << v[i].first + 1 << " " << v[i].second + 1 << endl;
  }
  return 0;
}
