#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC optimize("no-stack-protector,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int N = 2e4 + 100, T = 1100, OO = 1e9 + 7, M = 1e9 + 7, P = 6151,
          SQ = 360, LG = 15;
int a[N], id[N], i, j, k, l, n, m, x;
vector<pair<int, int> > ans;
void srt(int &x, int &y, int &z, int &xx, int &yy, int &zz) {
  if (x > y) swap(x, y), swap(xx, yy);
  if (x > z) swap(x, z), swap(xx, zz);
  if (y > z) swap(y, z), swap(yy, zz);
}
void work(int i) {
  int x = a[i], y = a[i + 1], z = a[i + 2], xx = id[i], yy = id[i + 1],
      zz = id[i + 2], p;
  srt(x, y, z, xx, yy, zz);
  while (x) {
    p = y / x;
    while (p) {
      if (p & 1)
        y -= x, x += x, ans.push_back({xx, yy});
      else
        z -= x, x += x, ans.push_back({xx, zz});
      p /= 2;
    }
    srt(x, y, z, xx, yy, zz);
  }
  a[i] = x;
  a[i + 1] = y;
  a[i + 2] = z;
  id[i] = xx;
  id[i + 1] = yy;
  id[i + 2] = zz;
}
int32_t main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> m;
  for (i = 1; i <= m; i++) {
    cin >> x;
    if (x) a[++n] = x, id[n] = i;
  }
  if (n < 2) return cout << -1, 0;
  for (i = 1; i <= n - 2; i++) work(i);
  cout << (int)ans.size() << endl;
  for (i = 0; i < (int)ans.size(); i++)
    cout << ans[i].first << " " << ans[i].second << endl;
  return 0;
}
