#include <bits/stdc++.h>
using namespace std;
vector<bool> q;
vector<int> b, a;
void rec(int k, int n, int num) {
  if (q[1] == true) return;
  for (int i = n - 1; i > 0; i--) {
    if (k == 0) return;
    if (q[1]) return;
    if (!q[i]) {
      k--;
      q[i] = true;
      cout << num << " " << b[i] << endl;
      rec(a[i], n, b[i]);
    }
  }
}
int main() {
  int n;
  cin >> n;
  q.resize(n, false);
  a.resize(n);
  b.resize(n);
  int s;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = i + 1;
    s += a[i];
  }
  int key, j, m;
  for (int i = 1; i < n; i++) {
    key = a[i];
    m = b[i];
    j = i - 1;
    while (j >= 1 && key < a[j]) {
      a[j + 1] = a[j];
      b[j + 1] = b[j];
      j--;
    }
    a[j + 1] = key;
    b[j + 1] = m;
  }
  if (s >= n - 1 && a[0] > 0) {
  } else {
    cout << -1;
    return 0;
  }
  cout << n - 1 << endl;
  rec(a[0], n, b[0]);
  return 0;
}
