#include <bits/stdc++.h>
using namespace std;
int inf_int = 1e9;
long long inf_ll = 1e16;
const double pi = 3.1415926535898;
bool debug = 0;
const int MAXN = 3e5 + 100;
int mod = 1e9 + 7;
char used[MAXN];
void solve() {
  int n;
  cin >> n;
  vector<pair<int, int> > a;
  int x;
  cin >> x;
  for (int i = 2; i <= n; ++i) {
    int x;
    cin >> x;
    a.push_back({x, i});
  }
  sort(a.rbegin(), a.rend());
  queue<pair<int, int> > q;
  int l = 0;
  q.push({x, 1});
  vector<pair<int, int> > ans;
  while (!q.empty() && l < a.size()) {
    int v = q.front().second, k = q.front().first;
    q.pop();
    used[v] = 1;
    while (k-- && l < a.size()) {
      q.push(a[l]);
      ans.push_back({v, a[l].second});
      ++l;
    }
  }
  if (ans.size() < n - 1) {
    cout << -1;
  } else {
    cout << ans.size() << "\n";
    for (int i = 0; i < ans.size(); ++i) {
      cout << ans[i].first << " " << ans[i].second << "\n";
    }
  }
}
int main() {
  if (!debug) {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  }
  int t = 1;
  while (t--) solve();
  return 0;
}
