#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
pair<int, int> v;
vector<pair<int, int> > ans;
int val[N], b[3], n;
int cmp(int x, int y) { return val[x] < val[y]; }
inline void doit(int x, int y) {
  ans.push_back(make_pair(x, y));
  val[y] -= val[x];
  val[x] <<= 1;
}
inline void solve(int a[3]) {
  sort(a, a + 3, cmp);
  if (!val[a[0]]) {
    v = make_pair(a[1], a[2]);
    return;
  }
  int t = val[a[1]] / val[a[0]];
  for (; t; t >>= 1)
    if (t & 1)
      doit(a[0], a[1]);
    else
      doit(a[0], a[2]);
  solve(a);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &val[i]);
  for (int i = 1; i <= n; i++)
    if (val[i]) {
      if (!v.first)
        v.first = i;
      else if (!v.second)
        v.second = i;
      else
        b[0] = v.first, b[1] = v.second, b[2] = i, solve(b);
    }
  if (!v.second) {
    puts("-1");
    return 0;
  }
  printf("%d\n", (int)ans.size());
  for (pair<int, int> i : ans) printf("%d %d\n", i.first, i.second);
}
