#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> a;
vector<pair<int, int>> res;
multiset<int> to;
set<pair<int, int>> used;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n;
  a.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 1; i < n; ++i) {
    used.insert(make_pair(-a[i], i));
  }
  for (int i = 0; i < a[0]; ++i) {
    to.insert(0);
  }
  while (!used.empty() && !to.empty()) {
    int from = *to.begin();
    to.erase(to.begin());
    pair<int, int> send = *used.begin();
    used.erase(used.begin());
    res.push_back(make_pair(from, send.second));
    for (int i = 0; i < a[send.second]; ++i) {
      to.insert(send.second);
    }
  }
  if (used.empty()) {
    cout << res.size() << "\n";
    for (int i = 0; i < res.size(); ++i) {
      cout << res[i].first + 1 << " " << res[i].second + 1 << "\n";
    }
  } else {
    cout << -1 << "\n";
  }
}
