#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void smin(T &a, U b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, U b) {
  if (a < b) a = b;
}
int n, i, a[1010], first, second = 1, z = 2, o, k;
pair<int, int> ans[1010 * 1010];
void sort() {
  if (a[first] > a[second]) swap(first, second);
  if (a[first] > a[z]) swap(first, z);
  if (a[second] > a[z]) swap(second, z);
}
void ok(int u) {
  ans[o].first = first, ans[o++].second = u;
  a[u] -= a[first];
  a[first] *= 2;
}
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", a + i);
  for (i = 3; i <= n; i++) {
    first = i;
    while (1) {
      sort();
      if (a[first] == 0) break;
      k = a[second] / a[first];
      while (k) {
        if (k % 2)
          ok(second);
        else
          ok(z);
        k /= 2;
      }
    }
  }
  if ((!!a[first]) + (!!a[second]) + (!!a[z]) != 2) return puts("-1"), 0;
  printf("%d\n", o);
  for (i = 0; i < o; i++) printf("%d %d\n", ans[i].first, ans[i].second);
  return 0;
}
