#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
inline void chmin(A& a, B b) {
  if (a > b) a = b;
}
template <typename A, typename B>
inline void chmax(A& a, B b) {
  if (a < b) a = b;
}
template <class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>& p) {
  ost << "{" << p.first << "," << p.second << "}";
  return ost;
}
template <class T>
ostream& operator<<(ostream& ost, const vector<T>& v) {
  ost << "{";
  for (long long i = 0; i < v.size(); i++) {
    if (i) ost << ",";
    ost << v[i];
  }
  ost << "}";
  return ost;
}
vector<pair<long long, long long> > ans;
void solve(vector<long long> D, long long off) {
  if (D.size() == 0) {
    return;
  }
  if (D.size() == 1) {
    for (long long i = 0; i <= D[0]; i++) {
      for (long long j = i + 1; j <= D[0]; j++) {
        ans.emplace_back(i + off, j + off);
      }
    }
    return;
  }
  vector<long long> DD;
  for (long long i = 1; i + 1 < D.size(); i++) DD.push_back(D[i] - D[0]);
  solve(DD, off + D[0]);
  long long num;
  if (DD.size())
    num = DD.back() + 1;
  else
    num = 1;
  for (long long i = 0; i < (D[0]); i++) {
    for (long long j = i + 1; j <= D.back(); j++) {
      ans.emplace_back(i + off, j + off);
    }
  }
}
signed main() {
  long long N;
  scanf("%lld", &N);
  vector<long long> D(N);
  for (long long i = 0; i < (N); i++) scanf("%lld", &D[i]);
  solve(D, 0);
  printf("%lld\n", (long long)ans.size());
  for (auto& p : ans) printf("%lld %lld\n", p.first + 1, p.second + 1);
  return 0;
}
