#include <bits/stdc++.h>
struct P {
  int id, messages;
  bool operator<(P other) const { return messages < other.messages; }
};
int main(void) {
  std::ios_base::sync_with_stdio(false);
  int n;
  std::cin >> n;
  std::vector<int> a(n);
  for (int i(0); i < n; ++i) std::cin >> a[i];
  std::priority_queue<P> knows;
  std::priority_queue<P> doesnt;
  std::vector<std::pair<int, int> > messages;
  for (int i(1); i < n; ++i) doesnt.push({i + 1, a[i]});
  if (a[0] == 0) {
    std::cout << -1 << "\n";
    return 0;
  }
  knows.push({1, a[0]});
  while (!doesnt.empty() and !knows.empty()) {
    P cur = knows.top();
    knows.pop();
    P next = doesnt.top();
    doesnt.pop();
    if (cur.messages != 1) knows.push({cur.id, cur.messages - 1});
    if (next.messages != 0) knows.push({next.id, next.messages});
    messages.push_back({cur.id, next.id});
  }
  if (!doesnt.empty()) {
    std::cout << -1 << "\n";
    return 0;
  }
  std::cout << messages.size() << "\n";
  for (auto v : messages) std::cout << v.first << " " << v.second << "\n";
}
