#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > ans;
pair<int, int> nA, nB;
void emptyOne(pair<int, int> A, pair<int, int> B, pair<int, int> C) {
  if (A.first > B.first) swap(A, B);
  if (A.first > C.first) swap(A, C);
  if (B.first > C.first) swap(B, C);
  if (A.first == 0) {
    nA = B;
    nB = C;
    return;
  }
  int b = B.first / A.first;
  while (b) {
    if (b & 1) {
      ans.push_back(make_pair(A.second, B.second));
      B.first -= A.first;
      A.first *= 2;
    } else {
      ans.push_back(make_pair(A.second, C.second));
      C.first -= A.first;
      A.first *= 2;
    }
    b >>= 1;
  }
  emptyOne(A, B, C);
}
int main() {
  int n;
  scanf("%d", &n);
  vector<pair<int, int> > a(n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i].first), a[i].second = i + 1;
  sort(a.begin(), a.end());
  if (a[a.size() - 1].first == 0 || a[a.size() - 2].first == 0) {
    printf("%d", -1);
    printf("\n");
    return 0;
  }
  int i = 0;
  while (a[i].first == 0) i++;
  while (i + 2 < a.size()) {
    emptyOne(a[i], a[i + 1], a[i + 2]);
    a[i + 1] = nA;
    a[i + 2] = nB;
    i++;
  }
  printf("%d\n", int(ans.size()));
  for (int i = 0; i < ans.size(); i++)
    printf("%d %d\n", ans[i].first, ans[i].second);
}
