#include <bits/stdc++.h>
using namespace std;
int n, m = 0, a[1010], op[1010101][2];
set<pair<int, int> > s;
void cut() {
  int cnt = 0;
  for (int i = 1; i <= n; ++i) cnt += (a[i] != 0);
  if (cnt == 2) cout << '0' << endl, exit(0);
  if (cnt < 2) cout << "-1" << endl, exit(0);
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i], s.insert(pair<int, int>(a[i], i));
  cut();
  while (!s.begin()->first) s.erase(*s.begin());
  while (distance(s.begin(), s.end()) > 2) {
    pair<int, int> a, b, c;
    int k;
    a = *s.begin(), s.erase(a);
    b = *s.begin(), s.erase(b);
    c = *s.begin(), s.erase(c);
    for (k = b.first / a.first; a.first <= b.first;
         k >>= 1, a.first <<= 1, op[m++][0] = a.second)
      if (k & 1)
        b.first -= a.first, op[m][1] = b.second;
      else
        c.first -= a.first, op[m][1] = c.second;
    if (a.first) s.insert(a);
    if (b.first) s.insert(b);
    if (c.first) s.insert(c);
  }
  cout << m << endl;
  for (int i = 0; i < m; ++i) cout << op[i][0] << " " << op[i][1] << endl;
  return 0;
}
