#include <bits/stdc++.h>
using namespace std;
set<pair<int, int> > S;
int n, a[10000];
vector<pair<int, int> > v;
void dfs(int x) {
  vector<int> go;
  for (int i = 1; i <= a[x]; ++i) {
    if (S.empty()) break;
    go.push_back((*--S.end()).second);
    S.erase(--S.end());
  }
  for (auto it : go) {
    v.push_back(make_pair(x, it));
    dfs(it);
  }
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    if (i == 1) continue;
    S.insert(make_pair(a[i], i));
  }
  dfs(1);
  if (!S.empty()) {
    cout << -1;
    return 0;
  }
  cout << v.size() << endl;
  for (auto it : v) {
    cout << it.first << ' ' << it.second << endl;
  }
  return 0;
}
