#include <bits/stdc++.h>
using namespace std;
inline int bit(int x, int i) { return (x >> i) & 1; }
int n, x[1010];
vector<pair<int, int> > sol;
void move(int a, int b) {
  sol.push_back(make_pair(b, a));
  x[a] -= x[b];
  x[b] *= 2;
}
void solve(int a, int b, int c) {
  while (x[a] && x[b] && x[c]) {
    for (int i = 0; i < (3); i++) {
      if (x[a] > x[b]) swap(a, b);
      if (x[b] > x[c]) swap(b, c);
    }
    int q = x[b] / x[a], i = 0;
    while (x[b] >= x[a]) {
      if (bit(q, i++))
        move(b, a);
      else
        move(c, a);
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = (int)(1); i <= (int)(n); i++) scanf("%d", x + i);
  int a = 0, b = 0, c = 0;
  for (int i = (int)(1); i <= (int)(n); i++) {
    if (x[a] == 0)
      a = i;
    else if (x[b] == 0)
      b = i;
    else if (x[c] == 0)
      c = i;
    solve(a, b, c);
  }
  if (!!x[a] + !!x[b] + !!x[c] != 2)
    puts("-1");
  else {
    printf("%d\n", ((int)(sol).size()));
    for (__typeof((sol).begin()) it = (sol).begin(); it != (sol).end(); it++)
      printf("%d %d\n", it->first, it->second);
  }
  return 0;
}
