#include <bits/stdc++.h>
int main(void) {
  int i, j, ct, moves, tmp, p1, p2, p3, arr[1001], ans1[100000], ans2[100000];
  scanf("%d", &ct);
  for (i = 1; i <= ct; scanf("%d", arr + i++))
    ;
  for (p2 = 1, p3 = 2, i = 3; i <= ct; ++i)
    for (p1 = i;;) {
      if (arr[p1] > arr[p2]) {
        tmp = p1;
        p1 = p2;
        p2 = tmp;
      }
      if (arr[p2] > arr[p3]) {
        tmp = p2;
        p2 = p3;
        p3 = tmp;
      }
      if (arr[p1] > arr[p2]) {
        tmp = p1;
        p1 = p2;
        p2 = tmp;
      }
      if (arr[p1] == 0) {
        break;
      }
      for (j = arr[p2] / arr[p1]; j; j >>= 1)
        if (j & 1) {
          ans1[++moves] = p1;
          ans2[moves] = p2;
          arr[p2] -= arr[p1];
          arr[p1] <<= 1;
        } else {
          ans1[++moves] = p1;
          ans2[moves] = p3;
          arr[p3] -= arr[p1];
          arr[p1] <<= 1;
        }
    }
  if ((arr[p1] == 0) + (arr[p2] == 0) + (arr[p3] == 0) != 1) {
    puts("-1");
  } else {
    for (printf("%d\n", moves), i = 1; i <= moves; ++i) {
      printf("%d %d\n", ans1[i], ans2[i]);
    }
  }
  return 0;
}
