#include <bits/stdc++.h>
using namespace std;
const long long N = (long long)(5e5) + 322;
const long long INF = (long long)(1e9);
const long long mod = (long long)(1e9) + 7;
const double eps = 1e-9;
set<pair<int, int> > S;
int n, a[N];
vector<pair<int, int> > res;
void go(int x) {
  vector<int> v;
  for (long long i = 1; i <= a[x]; ++i) {
    if ((int)(S.size()) > 0) {
      v.push_back((--S.end())->second);
      S.erase(--S.end());
    }
  }
  for (auto to : v) res.push_back(make_pair(x, to));
  for (auto to : v) go(to);
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (long long i = 1; i <= n; ++i) {
    cin >> a[i];
    if (i != 1) S.insert(make_pair(a[i], i));
  }
  go(1);
  if ((int)(S.size()) > 0) {
    cout << -1;
    return 0;
  }
  cout << (int)(res.size()) << "\n";
  for (auto it : res) cout << it.first << ' ' << it.second << "\n";
  return 0;
}
