#include <bits/stdc++.h>
using namespace std;
const int MAX_SIZE = 1010;
int data[MAX_SIZE];
int id[MAX_SIZE];
int from[MAX_SIZE * MAX_SIZE], to[MAX_SIZE * MAX_SIZE];
int n, cnt, step;
void emptyOne(int a, int b, int c) {
  if (data[id[a]] > data[id[b]]) swap(id[a], id[b]);
  if (data[id[b]] > data[id[c]]) swap(id[b], id[c]);
  if (data[id[a]] > data[id[b]]) swap(id[a], id[b]);
  if (data[id[a]] == 0) return;
  int div = data[id[b]] / data[id[a]];
  while (div) {
    if (div & 1) {
      from[step] = id[b];
      to[step] = id[a];
      data[id[b]] -= data[id[a]];
      data[id[a]] <<= 1;
    } else {
      from[step] = id[c];
      to[step] = id[a];
      data[id[c]] -= data[id[a]];
      data[id[a]] <<= 1;
    }
    ++step;
    div >>= 1;
  }
  emptyOne(a, b, c);
}
int main() {
  scanf("%d", &n);
  cnt = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", data + i);
    if (data[i]) id[cnt++] = i;
  }
  if (cnt < 2)
    fputs("-1\n", stdout);
  else {
    step = 0;
    for (int i = 0; i < cnt - 2; i++) emptyOne(i, i + 1, i + 2);
    printf("%d\n", step);
    for (int i = 0; i < step; i++) printf("%d %d\n", to[i], from[i]);
  }
  return 0;
}
