#include <bits/stdc++.h>
using namespace std;
int n, a[1100], q[5], x[1100000], y[1100000], num = 0, N = 0;
void merge(int i, int j, int k) {
  if (a[i] > a[j]) swap(i, j);
  if (a[i] > a[k]) swap(i, k);
  if (a[j] > a[k]) swap(k, j);
  if (a[i] == 0) return;
  int t = a[j] / a[i];
  for (int z = 0; z <= 20 && (1 << z) <= t; z++)
    if (t & (1 << z))
      a[j] -= a[i], a[i] *= 2, ++num, x[num] = i, y[num] = j;
    else
      a[k] -= a[i], a[i] *= 2, ++num, x[num] = i, y[num] = k;
  merge(i, j, k);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (a[i]) ++N;
  }
  if (N < 2) {
    printf("-1\n");
    return 0;
  }
  while (N > 2) {
    q[0] = 0;
    for (int i = 1; i <= n; i++)
      if (a[i] > 0) {
        q[++q[0]] = i;
        if (q[0] == 3) break;
      }
    merge(q[1], q[2], q[3]);
    N -= (int)(a[q[1]] == 0) + (int)(a[q[2]] == 0) + (int)(a[q[3]] == 0);
  }
  printf("%d\n", num);
  for (int i = 1; i <= num; i++) printf("%d %d\n", x[i], y[i]);
  return 0;
}
