#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x;
  vector<pair<int, bool>> a;
  vector<pair<int, int>> history;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &x);
    a.push_back(make_pair(x, false));
  }
  a[0].second = true;
  queue<pair<int, int>> q;
  q.push(make_pair(a[0].first, 0));
  while (!q.empty()) {
    auto k = q.front();
    for (int i = 0; i < k.first; ++i) {
      int maxVal = -1;
      int pos = 0;
      for (int j = 0; j < n; ++j) {
        if (!a[j].second && a[j].first > maxVal) {
          maxVal = a[j].first;
          pos = j;
        }
      }
      if (pos == 0) break;
      history.push_back(make_pair(k.second + 1, pos + 1));
      a[pos].second = true;
      q.push(make_pair(a[pos].first, pos));
    }
    q.pop();
  }
  if (find_if(a.begin(), a.end(), [](const pair<int, bool> &rhs) {
        return !rhs.second;
      }) == a.end()) {
    printf("%d\n", history.size());
    for (auto &it : history) printf("%d %d\n", it.first, it.second);
  } else
    printf("-1");
  return 0;
}
