#include <bits/stdc++.h>
using namespace std;
int n, a[2000], a1[1100000], a2[1100000], la;
void go(int u, int v) {
  a[v] -= a[u], a[u] += a[u];
  a1[++la] = u, a2[la] = v;
}
int work(int u, int v, int w) {
  if (a[v] < a[u]) swap(v, u);
  if (a[w] < a[u]) swap(w, u);
  if (a[w] < a[v]) swap(v, w);
  int q = a[v] / a[u];
  for (int j = 0; q; q >>= 1, ++j) {
    if (q & 1)
      go(u, v);
    else
      go(u, w);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= (n); ++i) scanf("%d", a + i);
  int u(1);
  while (u <= n && a[u] == 0) ++u;
  int v(u + 1);
  while (v <= n && a[v] == 0) ++v;
  int w(v + 1);
  while (w <= n && a[w] == 0) ++w;
  if (v > n)
    printf("-1\n");
  else if (w > n)
    printf("0\n");
  else {
    for (;;) {
      work(u, v, w);
      int nxt = w + 1;
      while (nxt <= n && a[nxt] == 0) ++nxt;
      if (!a[u]) {
        u = v, v = w, w = nxt;
      } else if (!a[v]) {
        v = w, w = nxt;
      } else if (!a[w])
        w = nxt;
      if (w > n) break;
    }
    printf("%d\n", la);
    for (int i = 1; i <= (la); ++i) printf("%d %d\n", a1[i], a2[i]);
  }
  return 0;
}
