#include <bits/stdc++.h>
using namespace std;
set<pair<int, int> > mp;
vector<pair<int, int> > ans;
int f[1000];
void gao(int a, int b, int c) {
  int k = f[b] / f[a];
  for (int i = 1; i <= k; i *= 2) {
    if (i & k) {
      f[b] -= f[a];
      f[a] *= 2;
      ans.push_back(make_pair(a, b));
    } else {
      f[c] -= f[a];
      f[a] *= 2;
      ans.push_back(make_pair(a, c));
    }
  }
}
int main() {
  int n;
  while (scanf("%d ", &n) != EOF) {
    mp.clear();
    ans.clear();
    for (int i = 0; i < n; ++i) {
      int x;
      scanf("%d ", &x);
      f[i] = x;
      if (x) mp.insert(make_pair(x, i));
    }
    if (mp.size() < 2) {
      cout << -1 << endl;
      continue;
    } else {
      while (mp.size() > 2) {
        int a = mp.begin()->second;
        mp.erase(mp.begin());
        int b = mp.begin()->second;
        mp.erase(mp.begin());
        int c = mp.begin()->second;
        mp.erase(mp.begin());
        gao(a, b, c);
        if (f[a]) mp.insert(make_pair(f[a], a));
        if (f[b]) mp.insert(make_pair(f[b], b));
        if (f[c]) mp.insert(make_pair(f[c], c));
      }
      cout << ans.size() << endl;
      for (int i = 0; i < ans.size(); ++i)
        cout << ans[i].first + 1 << ' ' << ans[i].second + 1 << endl;
    }
  }
}
