#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > ans;
void solve(pair<int, int> &a, pair<int, int> &b, pair<int, int> &c) {
  for (;;) {
    if (c.first < b.first) swap(b, c);
    if (b.first < a.first) swap(a, b);
    if (c.first < b.first) swap(b, c);
    if (a.first == 0) break;
    int k = b.first / a.first;
    for (int i = 0; (1 << i) <= k; i++) {
      if (k & (1 << i)) {
        b.first -= a.first;
        a.first *= 2;
        ans.emplace_back(a.second, b.second);
      } else {
        c.first -= a.first;
        a.first *= 2;
        ans.emplace_back(a.second, c.second);
      }
    }
  }
}
bool solve(vector<pair<int, int> > v) {
  if (v.size() < 2) return false;
  while (v.size() > 2) {
    random_shuffle(v.begin(), v.end());
    pair<int, int> a = v.back();
    v.pop_back();
    pair<int, int> b = v.back();
    v.pop_back();
    pair<int, int> c = v.back();
    v.pop_back();
    solve(a, b, c);
    if (a.first) v.push_back(a);
    if (b.first) v.push_back(b);
    if (c.first) v.push_back(c);
  }
  return true;
}
const int N = 1010;
int a[N];
void go(int i, int j) {
  a[j] -= a[i];
  a[i] += a[i];
}
int main() {
  int n;
  cin >> n;
  vector<pair<int, int> > v;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a[i] = x;
    if (x) v.emplace_back(x, i + 1);
  }
  random_shuffle(v.begin(), v.end());
  if (solve(v)) {
    cout << ans.size() << '\n';
    for (auto xy : ans) {
      cout << xy.first << ' ' << xy.second << '\n';
    }
  } else
    cout << "-1\n";
  return 0;
}
