#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000005;
const int N = 1005;
int a[N], ra[N * N], rb[N * N], k;
void work(int x, int y, int z) {
  if (!a[x]) return;
  int q = a[y] / a[x], r = a[y] % a[x], t = a[x];
  while (q > 0) {
    if (q % 2) {
      ra[k] = x;
      rb[k] = y;
      k++;
      a[x] += t;
      a[y] -= t;
    } else {
      ra[k] = x;
      rb[k] = z;
      k++;
      a[x] += t;
      a[z] -= t;
    }
    q /= 2;
    t *= 2;
  }
  if (a[z] > a[x])
    work(y, x, z);
  else
    work(y, z, x);
}
bool cmp(int x, int y) { return a[x] < a[y]; }
int main() {
  int n, i, t = 0;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (a[i] > 0) t++;
  }
  if (t < 2) {
    puts("-1");
    return 0;
  }
  while (t > 2) {
    int p[4], z = 0;
    for (i = 1; i <= n && z < 3; i++) {
      if (a[i] > 0) p[z++] = i;
    }
    sort(p, p + 3, cmp);
    work(p[0], p[1], p[2]);
    t--;
  }
  printf("%d\n", k);
  for (i = 0; i < k; i++) {
    printf("%d %d\n", ra[i], rb[i]);
  }
  return 0;
}
