#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1e3 + 10;
const int INF = 1e9;
const int MOD = 1e9 + 7;
int n, a[MaxN];
vector<pair<int, int> > ans;
int main() {
  cin >> n;
  set<pair<int, int> > b;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    if (a[i] == 0) {
      continue;
    }
    b.insert(make_pair(a[i], i));
  }
  if (b.size() < 2) {
    cout << -1 << '\n';
    exit(0);
  }
  while (b.size() > 2) {
    pair<int, int> x = *b.begin();
    b.erase(b.begin());
    pair<int, int> y = *b.begin();
    b.erase(b.begin());
    pair<int, int> z = *b.begin();
    b.erase(b.begin());
    int d = y.first / x.first;
    for (int step = 0; (1 << step) <= d; ++step) {
      if (d & (1 << step)) {
        ans.push_back(make_pair(x.second, y.second));
        y.first -= x.first;
      } else {
        ans.push_back(make_pair(x.second, z.second));
        z.first -= x.first;
      }
      x.first *= 2;
    }
    swap(x, y);
    if (x.first != 0) {
      b.insert(x);
    }
    b.insert(y);
    b.insert(z);
  }
  cout << (int)ans.size() << '\n';
  for (int i = 0; i < (int)ans.size(); ++i) {
    printf("%d %d\n", ans[i].first, ans[i].second);
  }
  return 0;
}
