#include <bits/stdc++.h>
using namespace std;
struct point {
  int x, id;
  point(int x, int id) : x(x), id(id) {}
  point() {}
  friend bool operator<(const point &p, const point &q) { return p.x < q.x; }
} a[1010], b[1010];
int ansx[1000010], ansy[1000010], tot = 0;
void solve() {
  sort(b, b + 3);
  if (b[0].x == 0) return;
  if (b[0].x == b[1].x) {
    ansx[++tot] = b[1].id;
    ansy[tot] = b[0].id;
    b[1].x *= 2;
    return;
  }
  if (b[1].x == b[2].x) {
    ansx[++tot] = b[1].id;
    ansy[tot] = b[2].id;
    b[2] = b[0];
    b[1].x *= 2;
    return;
  }
  int x = b[1].x / b[0].x;
  int log = 0;
  for (log; (1 << log) <= x; log++)
    ;
  log--;
  for (int i = 0; i <= log; i++) {
    if (x & (1 << i)) {
      b[1].x -= b[0].x;
      b[0].x *= 2;
      ansx[++tot] = b[0].id;
      ansy[tot] = b[1].id;
    } else {
      b[2].x -= b[0].x;
      b[0].x *= 2;
      ansx[++tot] = b[0].id;
      ansy[tot] = b[2].id;
    }
  }
  sort(b, b + 3);
  solve();
}
int main() {
  int n;
  scanf("%d", &n);
  int x;
  int ct = 0;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    if (x) a[++ct] = point(x, i);
  }
  if (ct < 2) {
    cout << -1 << endl;
    return 0;
  }
  if (ct == 2) {
    cout << 0 << endl;
    return 0;
  }
  while (ct > 2) {
    b[0] = a[ct];
    b[1] = a[ct - 1];
    b[2] = a[ct - 2];
    solve();
    ct -= 3;
    a[++ct] = b[1], a[++ct] = b[2];
  }
  printf("%d\n", tot);
  for (int i = 1; i <= tot; i++) printf("%d %d\n", ansx[i], ansy[i]);
  return 0;
}
