#include <bits/stdc++.h>
using namespace std;
int n, tot, cnt;
int x[1010], q[1010];
int vx[200010], vy[200010];
bool cmp(const int &a, const int &b) { return x[a] < x[b]; }
void swapx(int i, int j) {
  x[j] -= x[i];
  x[i] <<= 1;
  vx[++cnt] = i;
  vy[cnt] = j;
}
void solve(int *q) {
  sort(q + 1, q + 4, cmp);
  if (x[q[1]] == 0) return;
  int v = x[q[2]] / x[q[1]];
  for (int i = 0; (1 << i) <= v; ++i)
    if ((v >> i) & 1)
      swapx(q[1], q[2]);
    else
      swapx(q[1], q[3]);
  solve(q);
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> x[i], tot += (bool)x[i];
  while (tot > 2) {
    tot = 0;
    for (int i = 1; i <= n; ++i)
      if (x[i]) q[++tot] = i;
    if (tot <= 2) break;
    solve(q);
  }
  if (tot < 2)
    printf("%d", -1);
  else {
    printf("%d\n", cnt);
    for (int i = 1; i <= cnt; ++i) printf("%d %d\n", vx[i], vy[i]);
  }
}
