#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n, x;
  cin >> n;
  vector<char> used(n);
  vector<pair<int, int> > aPlusPos(n);
  vector<pair<int, int> > ans;
  for (int i = 0; i < n; i++) {
    cin >> x;
    aPlusPos[i] = make_pair(x, i);
  }
  sort(aPlusPos.rbegin(), aPlusPos.rend());
  int pospol = 0;
  for (int i = 0; i < n; i++) {
    if (aPlusPos[i].second == 0) {
      pospol = i;
      break;
    }
  }
  queue<int> q;
  q.push(pospol);
  used[pospol] = 1;
  int pos = 0;
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    while (aPlusPos[v].first) {
      if (!used[pos]) {
        aPlusPos[v].first--;
        used[pos] = 1;
        q.push(pos);
        ans.push_back(make_pair(aPlusPos[v].second, aPlusPos[pos].second));
      }
      pos++;
      if (pos == n) {
        cout << ans.size() << '\n';
        for (int i = 0; i < ans.size(); i++) {
          cout << ans[i].first + 1 << ' ' << ans[i].second + 1 << '\n';
        }
        return 0;
      }
    }
  }
  cout << -1;
  return 0;
}
