#include <bits/stdc++.h>
void swap(int *a, int *b);
int i, j, n, c, p1, p2, p3;
int box[1001], A[100000], B[100000];
int main(void) {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", box + i);
  }
  p2 = 1;
  p3 = 2;
  for (i = 3; i <= n; ++i) {
    for (p1 = i;;) {
      if (box[p1] > box[p2]) {
        swap(&p1, &p2);
      }
      if (box[p2] > box[p3]) {
        swap(&p2, &p3);
      }
      if (box[p1] == 0) {
        break;
      }
      for (j = box[p2] / box[p1]; j; j >>= 1) {
        A[++c] = p1;
        if (j & 1) {
          B[c] = p2;
          box[p2] -= box[p1];
        } else {
          B[c] = p3;
          box[p3] -= box[p1];
        }
        box[p1] <<= 1;
      }
    }
  }
  if ((box[p1] == 0) + (box[p2] == 0) + (box[p3] == 0) != 1) {
    puts("-1");
  } else {
    printf("%d\n", c);
    for (i = 1; i <= c; i++) {
      printf("%d %d\n", A[i], B[i]);
    }
  }
  return 0;
}
void swap(int *a, int *b) {
  int temp;
  temp = *b;
  *b = *a;
  *a = temp;
}
