#include <bits/stdc++.h>
using namespace std;
struct tip {
  int val, pos;
  tip(int _val = 0, int _pos = 0) {
    val = _val;
    pos = _pos;
  }
};
bool operator<(const tip &A, const tip &B) { return A.val < B.val; }
vector<pair<tip, tip> > ans;
pair<tip, tip> solve(vector<tip> V) {
  sort(V.begin(), V.end());
  if (V[0].val == 0) return pair<tip, tip>(V[1], V[2]);
  if (V[1].val == 0) return pair<tip, tip>(V[0], V[2]);
  if (V[2].val == 0) return pair<tip, tip>(V[0], V[1]);
  int ratio = V[1].val / V[0].val;
  for (int i = 0; ratio; ++i) {
    V[0].val *= 2;
    if (ratio & 1) {
      ans.push_back(pair<tip, tip>(V[0], V[1]));
      V[1].val -= V[0].val / 2;
    } else {
      ans.push_back(pair<tip, tip>(V[0], V[2]));
      V[2].val -= V[0].val / 2;
    }
    ratio >>= 1;
  }
  return solve(V);
}
int n, shift;
pair<tip, tip> curr = pair<tip, tip>(tip(0, -1), tip(0, -1));
int main(void) {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    if (x == 0) continue;
    if (curr.first.pos == -1)
      curr.first = tip(x, i);
    else if (curr.second.pos == -1)
      curr.second = tip(x, i);
    if (curr.second.pos != -1) {
      shift = i + 1;
      break;
    }
  }
  n -= shift;
  if (curr.second.pos == -1) {
    printf("-1\n");
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    curr = solve({curr.first, curr.second, tip(x, i + shift)});
  }
  printf("%d\n", ans.size());
  for (int i = 0; i < ans.size(); ++i)
    printf("%d %d\n", ans[i].first.pos + 1, ans[i].second.pos + 1);
  return 0;
}
