#include <bits/stdc++.h>
using namespace std;
const int MAX_N = (int)4e4 + 5;
const int inf = (int)1e9 + 7;
int n;
int a[MAX_N];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  set<pair<int, int> > q, last;
  if (a[1]) q.insert(make_pair(a[1], 1));
  for (int i = 2; i <= n; i++) last.insert(make_pair(-a[i], i));
  vector<pair<int, int> > ans;
  while (!last.empty()) {
    int v = last.begin()->second;
    last.erase(last.begin());
    if (q.empty()) {
      cout << "-1\n";
      return 0;
    }
    int pr = q.begin()->second;
    q.erase(q.begin());
    ans.push_back(make_pair(pr, v));
    a[pr]--;
    if (a[pr]) q.insert(make_pair(a[pr], pr));
    if (a[v]) q.insert(make_pair(a[v], v));
  }
  cout << (int)((ans).size()) << endl;
  for (auto i : ans) cout << i.first << ' ' << i.second << endl;
  return 0;
}
