#include <bits/stdc++.h>
using namespace std;
pair<int, int> p[1010];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d", &p[i].first), p[i].second = i;
  sort(p + 1, p + n + 1);
  vector<pair<int, int> > ans;
  auto f = [&](pair<int, int> &a, pair<int, int> &b, pair<int, int> &c) {
    if (a.first == 0) return;
    if (a.first == b.first) {
      ans.emplace_back(b.second, a.second);
      a.first -= b.first;
      b.first <<= 1;
      return;
    }
    if (b.first == c.first) {
      ans.emplace_back(c.second, b.second);
      b.first -= c.first;
      c.first <<= 1;
      return;
    }
    while (a.first) {
      int d = b.first / a.first;
      while (d) {
        if (d & 1) {
          ans.emplace_back(a.second, b.second);
          b.first -= a.first;
        } else {
          ans.emplace_back(a.second, c.second);
          c.first -= a.first;
        }
        d >>= 1;
        a.first <<= 1;
      }
      if (a > b) swap(a, b);
      if (a > c) swap(a, c);
      if (b > c) swap(b, c);
    }
  };
  for (int i = 1; i <= n - 2; i++) {
    f(p[i], p[i + 1], p[i + 2]);
    sort(p + i, p + n + 1);
  }
  if (p[n - 1].first == 0) return puts("-1");
  cout << ans.size() << endl;
  for (auto res : ans) printf("%d %d\n", res.first, res.second);
  return 0;
}
