#include <bits/stdc++.h>
using namespace std;
pair<int, int> c[1000010];
int a[1100];
int n, cnt;
vector<pair<int, int> > o, q;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  o.push_back(make_pair(a[1], 1)), o.push_back(make_pair(a[2], 2));
  for (int i = 3; i <= n; i++) {
    o.push_back(make_pair(a[i], i));
    sort(o.begin(), o.end());
    while (o[0].first) {
      int t = o[1].first / o[0].first;
      for (int j = 0; j < 20; j++)
        if (o[1].first < o[0].first)
          break;
        else if (t & (1 << j))
          o[1].first -= o[0].first, o[0].first *= 2,
              c[++cnt] = make_pair(o[0].second, o[1].second);
        else
          o[2].first -= o[0].first, o[0].first *= 2,
              c[++cnt] = make_pair(o[0].second, o[2].second);
      sort(o.begin(), o.end());
    }
    q.clear();
    q.push_back(o[1]);
    q.push_back(o[2]);
    o.clear();
    o.push_back(q[0]);
    o.push_back(q[1]);
  }
  if (!o[0].first)
    printf("-1\n");
  else {
    printf("%d\n", cnt);
    for (int i = 1; i <= cnt; i++) printf("%d %d\n", c[i].first, c[i].second);
  }
}
