#include <bits/stdc++.h>
using namespace std;
int a[1000];
vector<pair<int, int> > ans;
int N;
int p = -1;
int next() {
  ++p;
  while (p < N && a[p] == 0) {
    ++p;
  }
  return p;
}
void move(int i, int j) {
  ans.push_back(make_pair(i, j));
  assert(a[i] <= a[j]);
  a[j] -= a[i];
  a[i] *= 2;
}
void threeIntoTwo(int i, int j, int k) {
  while (true) {
    if (a[i] > a[j]) {
      swap(i, j);
    }
    if (a[j] > a[k]) {
      swap(j, k);
    }
    if (a[i] > a[j]) {
      swap(i, j);
    }
    if (a[i] == 0) {
      return;
    }
    int q = a[j] / a[i];
    while (q > 0) {
      if (q & 1) {
        move(i, j);
      } else {
        move(i, k);
      }
      q /= 2;
    }
  }
}
int main() {
  int N;
  cin >> N;
  int not0Count = 0;
  for (int i = 0; i < N; ++i) {
    cin >> a[i];
    if (a[i]) {
      ++not0Count;
    }
  }
  if (not0Count < 2) {
    cout << -1 << '\n';
    return 0;
  }
  vector<int> cur(3);
  for (int i = 0; i < 3; ++i) {
    cur[i] = next();
  }
  while (*max_element((cur).begin(), (cur).end()) < N) {
    threeIntoTwo(cur[0], cur[1], cur[2]);
    for (int i = 0; i < 3; ++i) {
      if (a[cur[i]] == 0) {
        cur[i] = next();
      }
    }
  }
  cout << ans.size() << '\n';
  for (size_t i = 0; i < ans.size(); ++i) {
    cout << ans[i].first + 1 << ' ' << ans[i].second + 1 << '\n';
  }
  return 0;
}
