#include <bits/stdc++.h>
using namespace std;
int a[1111], ans1[1111111], ans2[1111111];
int main() {
  int N, m, p1;
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) scanf("%d", a + i);
  m = 0;
  int p2 = 1, p3 = 2;
  for (int i = 3; i <= N; i++) {
    for (p1 = i;;) {
      if (a[p1] > a[p2]) swap(p1, p2);
      if (a[p2] > a[p3]) swap(p2, p3);
      if (a[p1] > a[p3]) swap(p1, p3);
      if (a[p1] == 0) break;
      for (int j = a[p2] / a[p1]; j; j >>= 1)
        if (j & 1) {
          ans1[m] = p1;
          ans2[m++] = p2;
          a[p2] -= a[p1];
          a[p1] *= 2;
        } else {
          ans1[m] = p1;
          ans2[m++] = p3;
          a[p3] -= a[p1];
          a[p1] *= 2;
        }
    }
  }
  if ((a[p1] == 0) + (a[p2] == 0) + (a[p3] == 0) != 1)
    puts("-1");
  else {
    printf("%d\n", m);
    for (int i = 0; i < m; i++) printf("%d %d\n", ans1[i], ans2[i]);
  }
  return 0;
}
