#include <bits/stdc++.h>
using namespace std;
struct node {
  int x;
  int num;
} a[1005];
int n;
vector<pair<int, int> > res;
bool cmp(node a, node b) { return a.x < b.x; }
void did(node &a, node &b, node &c) {
  int k = a.x;
  for (int i = 0; i <= 20; i++) {
    if (a.x > b.x) break;
    if ((b.x / k) & (1 << i)) {
      b.x -= a.x;
      res.push_back(make_pair(a.num, b.num));
    } else {
      c.x -= a.x;
      res.push_back(make_pair(a.num, c.num));
    }
    a.x *= 2;
  }
  if (a.x > b.x) swap(a, b);
  if (b.x > c.x) swap(b, c);
  if (a.x > b.x) swap(a, b);
  if (a.x != 0) did(a, b, c);
}
int main() {
  scanf("%d", &n);
  int ge = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i].x);
    a[i].num = i;
    if (a[i].x != 0) ge++;
  }
  if (ge < 2) {
    puts("-1");
    return 0;
  }
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i + 2 <= n; i++) {
    if (a[i].x == 0 || a[i + 1].x == 0) continue;
    sort(a + i, a + i + 3, cmp);
    did(a[i], a[i + 1], a[i + 2]);
  }
  printf("%d\n", (int)res.size());
  for (int i = 0; i < (int)res.size(); i++) {
    printf("%d %d\n", res[i].first, res[i].second);
  }
  return 0;
}
