#include <bits/stdc++.h>
bool IsOk(std::pair<int32_t, int32_t>* Lim, int32_t n) {
  if (Lim[0].second == 0) {
    return false;
  }
  int32_t sum = 0;
  for (int32_t i = 0; i < n; i++) {
    sum += Lim[i].second;
    if (sum >= n - 1) {
      return true;
    }
  }
  return false;
}
bool cmp(const std::pair<int32_t, int32_t>& a,
         const std::pair<int32_t, int32_t>& b) {
  return a.second < b.second;
}
int main() {
  int32_t n;
  scanf("%d", &n);
  std::pair<int32_t, int32_t>* Limit = new std::pair<int32_t, int32_t>[n + 1];
  for (int32_t i = 0; i < n; i++) {
    scanf("%d", &(Limit[i].second));
  }
  for (int32_t i = 0; i < n; i++) {
    Limit[i].first = i + 1;
  }
  if (!(IsOk(Limit, n))) {
    printf("-1\n");
    return 0;
  }
  std::sort(&(Limit[1]), &(Limit[n]), cmp);
  printf("%d\n", n - 1);
  Limit[n] = Limit[0];
  int32_t cur = n, last = n - 1;
  for (int32_t i = 1; i < n; i++) {
    printf("%d %d\n", Limit[cur].first, Limit[last].first);
    last--;
    Limit[cur].second--;
    if (Limit[cur].second == 0) {
      cur--;
    }
  }
  return 0;
}
