#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool cmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool cmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
int n, m, on;
pair<int, int> op[1001234], a[1001234];
int main() {
  int i, j, k;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i].first);
    if (a[i].first) a[++m] = make_pair(a[i].first, i);
  }
  if (m < 2) return puts("-1"), 0;
  for (i = 1; i <= m - 2; i++) {
    sort(a + i, a + i + 3);
    while (a[i].first) {
      for (k = a[i + 1].first / a[i].first; k; a[i].first <<= 1, k >>= 1)
        if (k & 1) {
          op[on++] = make_pair(a[i + 1].second, a[i].second);
          a[i + 1].first -= a[i].first;
        } else {
          op[on++] = make_pair(a[i + 2].second, a[i].second);
          a[i + 2].first -= a[i].first;
        }
      sort(a + i, a + i + 3);
    }
  }
  printf("%d\n", on);
  for (i = 0; i < on; i++) printf("%d %d\n", op[i].second, op[i].first);
  return 0;
}
