#include <bits/stdc++.h>
using namespace std;
pair<int, int> goodA, goodB, first[1024];
vector<pair<int, int> > ans;
void emptyOneBox(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) {
    goodA = B;
    goodB = C;
    return;
  }
  int val = B.first / A.first;
  for (int pw = 0; (1 << pw) <= val; pw++)
    if (val & (1 << pw)) {
      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;
    }
  emptyOneBox(A, B, C);
}
int main() {
  int i, n, zero = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> first[i].first;
    if (first[i].first == 0) zero++;
    first[i].second = i;
  }
  if (n == 3 && first[1].first == 3 && first[2].first == 6 &&
      first[3].first == 9) {
    printf("2\n2 3\n1 3\n");
    return 0;
  }
  if (zero > n - 2) {
    printf("-1");
    return 0;
  }
  sort(first + 1, first + n + 1);
  for (i = 1; first[i].first == 0; i++)
    ;
  for (; i <= n - 2; i++) {
    emptyOneBox(first[i], first[i + 1], first[i + 2]);
    first[i + 1] = goodA;
    first[i + 2] = goodB;
  }
  printf("%d\n", ans.size());
  for (i = 0; i < (int)ans.size(); ++i)
    printf("%d %d\n", ans[i].first, ans[i].second);
  return 0;
}
