#include <bits/stdc++.h>
using namespace std;
int a, b, c, d, e, f, g[1005], h[1005], i, j, k;
int an[1005 * 1005][2];
int cnt, tot;
bool cmp(int x, int y) { return g[x] < g[y]; }
int main() {
  cin >> a;
  for (i = 1; i <= a; i++) cin >> g[i];
  for (i = 1; i <= a; i++)
    if (g[i] != 0) e++;
  if (e < 2) {
    cout << -1 << endl;
    return 0;
  }
  while (1) {
    tot = 0;
    for (i = 1; i <= a && tot < 3; i++)
      if (g[i] > 0) h[++tot] = i;
    if (tot == 2) break;
    sort(h + 1, h + 3 + 1, cmp);
    while (g[h[1]]) {
      e = g[h[2]] / g[h[1]];
      for (; e; e >>= 1)
        if (e & 1) {
          g[h[2]] -= g[h[1]];
          g[h[1]] <<= 1;
          an[++cnt][0] = h[1];
          an[cnt][1] = h[2];
        } else {
          g[h[3]] -= g[h[1]];
          g[h[1]] <<= 1;
          an[++cnt][0] = h[1];
          an[cnt][1] = h[3];
        }
      sort(h + 1, h + 3 + 1, cmp);
    }
  }
  cout << cnt << endl;
  for (i = 1; i <= cnt; i++) cout << an[i][0] << " " << an[i][1] << endl;
  return 0;
}
