#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &t) {
  os << "[";
  for (__typeof((t).begin()) it = (t).begin(); it != (t).end(); it++) {
    if (it != t.begin()) os << ",";
    os << *it;
  }
  os << "]";
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const set<T> &t) {
  os << "{";
  for (__typeof((t).begin()) it = (t).begin(); it != (t).end(); it++) {
    if (it != t.begin()) os << ",";
    os << *it;
  }
  os << "}";
  return os;
}
template <class S, class T>
ostream &operator<<(ostream &os, const pair<S, T> &t) {
  return os << "(" << t.first << "," << t.second << ")";
}
template <class S, class T>
pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) {
  return pair<S, T>(s.first + t.first, s.second + t.second);
}
template <class S, class T>
pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) {
  return pair<S, T>(s.first - t.first, s.second - t.second);
}
const long long int INF = 1ll << 60;
const double EPS = 1e-8;
const int MOD = 1000000007;
int T, n, m;
int main(int argc, char *argv[]) {
  cin >> m;
  vector<int> d(m);
  for (int i = 0; i < (int)(m); i++) cin >> d[i];
  int n = d.back() + 1;
  vector<int> deg(n);
  vector<pair<int, int> > e;
  while (!d.empty()) {
    for (int i = n - d[0]; i < n; i++) {
      for (int j = 0; j < (int)(i); j++) {
        e.emplace_back(i, j);
      }
    }
    d.pop_back();
    for (int i = ((int)(d.size()) - 1); i >= 0; i--) d[i] -= d[0];
    if (!d.empty()) {
      d.erase(d.begin());
      n = d.back() + 1;
    }
  }
  cout << e.size() << endl;
  for (auto it : e) {
    cout << it.first + 1 << " " << it.second + 1 << endl;
    deg[it.first]++;
    deg[it.second]++;
  }
  cerr << deg << endl;
  return 0;
}
