#include <bits/stdc++.h>
using namespace std;
int n;
int data[1010];
int a, b, c, tmp;
vector<pair<int, int> > ans;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d ", data + i);
  for (int i = 1; i <= n; ++i) {
    if (!data[a]) {
      a = i;
      continue;
    }
    if (!data[b]) {
      b = i;
      continue;
    }
    c = i;
    for (;;) {
      if (data[a] > data[b]) swap(a, b);
      if (data[b] > data[c]) swap(b, c);
      if (data[a] > data[b]) swap(a, b);
      ;
      if (!data[a]) break;
      for (int i = data[b] / data[a]; i; i >>= 1) {
        tmp = (i & 1) ? b : c;
        ans.push_back(make_pair(a, tmp));
        data[tmp] -= data[a];
        data[a] <<= 1;
      }
    }
    a = b, b = c;
  }
  if (!!data[a] + !!data[b] != 2)
    printf("-1\n");
  else {
    printf("%d\n", ans.size());
    for (__typeof(ans.begin()) cur = ans.begin(); cur != ans.end(); ++cur)
      printf("%d %d\n", cur->first, cur->second);
  }
  return 0;
}
