#include <bits/stdc++.h>
typedef struct box {
  int amount;
  int index;
} box;
typedef struct pair {
  int x1, x2;
} pair;
typedef int (*compfn)(const void *, const void *);
int compare(box *, box *);
void swap(box *, int, int);
int main(void) {
  box *candy;
  pair *answers;
  int ansCtr = 0;
  int n;
  scanf(" %d", &n);
  candy = (box *)malloc(sizeof(box) * n);
  answers = (pair *)malloc(sizeof(pair));
  if (candy != NULL && answers != NULL) {
    int i;
    int zeroCount = 0;
    for (i = 0; i < n; i++) {
      scanf(" %d", &candy[i].amount);
      candy[i].index = i;
      if (candy[i].amount == 0) {
        zeroCount++;
      }
    }
    if (zeroCount > n - 2) {
      printf("-1\n");
    } else {
      qsort(candy, n, sizeof(box), (compfn)compare);
      for (i = 0; i < n; i++) {
        if (candy[i].amount != 0) {
          break;
        }
      }
      for (; i < n - 2; i++) {
        while (1) {
          int one, two, three;
          int val;
          int j;
          one = i;
          two = i + 1;
          three = i + 2;
          qsort(candy + one, 3, sizeof(box), (compfn)compare);
          if (candy[one].amount == 0) {
            break;
          }
          val = candy[two].amount / candy[one].amount;
          for (j = 0; (1 << j) <= val; j++) {
            pair *temp;
            if (val & (1 << j)) {
              answers[ansCtr].x1 = candy[one].index;
              answers[ansCtr].x2 = candy[two].index;
              candy[two].amount -= candy[one].amount;
              candy[one].amount *= 2;
            } else {
              answers[ansCtr].x1 = candy[one].index;
              answers[ansCtr].x2 = candy[three].index;
              candy[three].amount -= candy[one].amount;
              candy[one].amount *= 2;
            }
            ansCtr++;
            temp = (pair *)realloc(answers, (ansCtr + 1) * sizeof(pair));
            if (temp != NULL) {
              answers = temp;
            }
          }
        }
      }
      printf("%d\n", ansCtr);
      for (i = 0; i < ansCtr; i++) {
        printf("%d %d\n", answers[i].x1 + 1, answers[i].x2 + 1);
      }
    }
  }
  free(candy);
  free(answers);
  return 0;
}
int compare(box *a, box *b) {
  int ret = 0;
  if (a->amount < b->amount) {
    ret = -1;
  }
  if (a->amount > b->amount) {
    ret = 1;
  }
  return ret;
}
void swap(box *a, int x, int y) {
  box temp;
  temp = a[x];
  a[x] = a[y];
  a[y] = temp;
}
