#include <bits/stdc++.h>
using namespace std;
const int N = 1005, C = 1e6 + 5;
int n, m, s[N], t[N];
inline bool cmp(const int i, const int j) { return s[i] > s[j]; }
pair<int, int> ans[C];
void reduce(int a, int b, int c) {
  while (1) {
    if (s[a] > s[b]) swap(a, b);
    if (s[b] > s[c]) swap(b, c);
    if (s[a] > s[b]) swap(a, b);
    if (!s[a]) return;
    for (int q = s[b] / s[a]; q; s[a] *= 2, q >>= 1)
      if (q & 1)
        s[b] -= s[a], ans[m++] = pair<int, int>(a, b);
      else
        s[c] -= s[a], ans[m++] = pair<int, int>(a, c);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", s + i), t[i] = i;
  sort(t + 1, t + n + 1, cmp);
  while (n && !s[t[n]]) n--;
  if (n < 2) {
    puts("-1");
    return 0;
  }
  for (; n > 2; n--) {
    reduce(t[n - 2], t[n - 1], t[n]);
    if (!s[t[n - 2]]) t[n - 2] = t[n];
    if (!s[t[n - 1]]) t[n - 1] = t[n];
  }
  printf("%d\n", m);
  for (int i = 0; i < m; i++) printf("%d %d\n", ans[i].first, ans[i].second);
}
