#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma comment(linker, "/STACK:2000000")
using namespace std;
template <int D, typename T>
struct Vec : public vector<Vec<D - 1, T>> {
  static_assert(D >= 1, "Vector dimension must be greater than zero!");
  template <typename... Args>
  Vec(int n = 0, Args... args)
      : vector<Vec<D - 1, T>>(n, Vec<D - 1, T>(args...)) {}
};
template <typename T>
struct Vec<1, T> : public vector<T> {
  Vec(int n = 0, T val = T()) : vector<T>(n, val) {}
};
using ll = long long;
using db = long double;
using ii = pair<int, int>;
const int N = 1e6 + 5, LG = 19, MOD = 998244353;
const int SQ = 320;
const long double EPS = 1e-7;
void printCase(int cs) { cout << "Case #" << cs << ": "; }
int a[305], n;
vector<ii> edges;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i < n + 1; i++) cin >> a[i];
  for (int i = 1; i <= n - i + 1; i++)
    for (int j = a[i - 1] + 1; j < a[i] + 1; j++)
      for (int k = j + 1; k < a[n - i + 1] + 2; k++) edges.push_back(ii(j, k));
  cout << edges.size() << '\n';
  for (auto x : edges) cout << x.first << ' ' << x.second << '\n';
  return 0;
}
