#include <bits/stdc++.h>
using namespace std;
int a1[1000007], a2[1000007];
struct node {
  int v, id;
} A[1000007];
inline int read() {
  int x = 0, flag = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') flag = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  return x * flag;
}
void work(int &a, int &b) {
  b -= a;
  a <<= 1;
}
bool cmp(node x, node y) {
  if (x.v == y.v) {
    return x.id < y.id;
  } else
    return x.v > y.v;
}
int main() {
  int n = read();
  int cnt = 0;
  for (int i = 1; i <= n; ++i) {
    int x = read();
    A[++cnt].v = x;
    A[cnt].id = cnt;
  }
  sort(A + 1, A + 1 + cnt, cmp);
  if (!A[2].v) {
    puts("-1");
    return 0;
  }
  int m = 0;
  while (A[3].v) {
    int t = A[2].v / A[3].v;
    while (t) {
      if (t & 1) {
        A[2].v -= A[3].v;
        A[3].v <<= 1;
        m++;
        a1[m] = A[3].id;
        a2[m] = A[2].id;
      } else {
        A[1].v -= A[3].v;
        A[3].v <<= 1;
        m++;
        a1[m] = A[3].id;
        a2[m] = A[1].id;
      }
      t /= 2;
    }
    sort(A + 1, A + 1 + cnt, cmp);
  }
  printf("%d\n", m);
  for (int i = 1; i <= m; ++i) {
    printf("%d %d\n", a1[i], a2[i]);
  }
  return 0;
}
