#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 10;
pair<int, int> p[maxn];
int n, tot = 0, ans[maxn * maxn][2];
bool cmp(pair<int, int> a, pair<int, int> b) { return a.first > b.first; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &p[i].first), p[i].second = i;
  int cnt1 = 0;
  for (int i = 1; i <= n; i++)
    if (p[i].first != 0) cnt1++;
  if (cnt1 < 2) {
    printf("-1\n");
    return 0;
  }
  tot = 0;
  while (true) {
    sort(p + 1, p + 1 + n, cmp);
    if (p[1].first == 0 || p[2].first == 0 || p[3].first == 0) break;
    while (true) {
      sort(p + 1, p + 4);
      if (p[1].first == 0) break;
      int q = p[2].first / p[1].first;
      while (q > 0) {
        if (q & 1) {
          p[2].first -= p[1].first;
          p[1].first <<= 1;
          ans[++tot][0] = p[1].second, ans[tot][1] = p[2].second;
        } else {
          p[3].first -= p[1].first;
          p[1].first <<= 1;
          ans[++tot][0] = p[1].second, ans[tot][1] = p[3].second;
        }
        q >>= 1;
      }
    }
  }
  printf("%d\n", tot);
  for (int i = 1; i <= tot; i++) printf("%d %d\n", ans[i][0], ans[i][1]);
  return 0;
}
