#include <bits/stdc++.h>
using namespace std;
const int N = 1004;
int n, a[N], ans, s[1000004][2];
void print(int x) {
  printf("%d\n", x);
  exit(0);
}
bool com(int x, int y) { return (a[x] < a[y]); }
void move(int x, int y) {
  a[y] -= a[x];
  a[x] *= 2;
  s[++ans][0] = x;
  s[ans][1] = y;
}
void solve(int x[]) {
  int p = a[x[1]] / a[x[0]];
  while (p) {
    if (p % 2)
      move(x[0], x[1]);
    else
      move(x[0], x[2]);
    p /= 2;
  }
  sort(x, x + 3, com);
  if (!a[x[0]]) return;
  solve(x);
}
int main() {
  int i, cnt = 0, x[3];
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (cnt < 3) x[cnt] = i;
    if (a[i]) cnt++;
  }
  if (cnt < 2)
    print(-1);
  else if (cnt == 2)
    print(0);
  int now = x[2];
  ans = 0;
  while (1) {
    sort(x, x + 3, com);
    solve(x);
    if ((--cnt) == 2) break;
    sort(x, x + 3, com);
    now++;
    while (!a[now]) now++;
    x[0] = now;
  }
  printf("%d\n", ans);
  for (i = 1; i <= ans; i++) printf("%d %d\n", s[i][0], s[i][1]);
  return 0;
}
