#include <bits/stdc++.h>
using namespace std;
inline void filejudge() {
  freopen(".in", "r", stdin);
  freopen(".out", "w", stdout);
}
inline int read() {
  int x = 0;
  bool f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = 0;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  return f ? x : -x;
}
const int N = 1010;
int n, a[N];
int p1, p2, p3;
vector<pair<int, int> > ans;
inline void sortp() {
  if (a[p1] > a[p2]) swap(p1, p2);
  if (a[p2] > a[p3]) swap(p2, p3);
  if (a[p1] > a[p2]) swap(p1, p2);
}
inline void change(int x, int y) {
  ans.push_back(make_pair(x, y));
  a[y] -= a[x];
  a[x] <<= 1;
}
int main() {
  n = read();
  for (register int i = 1; i <= n; ++i) a[i] = read();
  p2 = 1;
  p3 = 2;
  for (register int i = 3; i <= n; ++i) {
    p1 = i;
    while (233) {
      sortp();
      if (a[p1] == 0) break;
      for (register int j = a[p2] / a[p1]; j; j >>= 1) {
        if (j & 1)
          change(p1, p2);
        else
          change(p1, p3);
      }
    }
  }
  if ((a[p1] > 0) + (a[p2] > 0) + (a[p3] > 0) != 2)
    puts("-1");
  else {
    printf("%d\n", ans.size());
    for (register signed i = 0; i < ans.size(); ++i)
      printf("%d %d\n", ans[i].first, ans[i].second);
  }
  return 0;
}
