#include <bits/stdc++.h>
using namespace std;
const int inf = ~0U >> 1;
const long long INF = ~0ULL >> 1;
template <class T>
inline void read(T &n) {
  char c;
  for (c = getchar(); !(c >= '0' && c <= '9'); c = getchar())
    ;
  n = c - '0';
  for (c = getchar(); c >= '0' && c <= '9'; c = getchar()) n = n * 10 + c - '0';
}
int Pow(int base, int n, int mo) {
  if (n == 0) return 1;
  if (n == 1) return base % mo;
  int tmp = Pow(base, n >> 1, mo);
  tmp = (long long)tmp * tmp % mo;
  if (n & 1) tmp = (long long)tmp * base % mo;
  return tmp;
}
int A[2000], n, N, x;
vector<pair<int, int> > ans;
set<int> S;
void merge(int a, int b, int c) {
  if (A[a] > A[b]) swap(a, b);
  if (A[a] > A[c]) swap(a, c);
  if (A[b] > A[c]) swap(b, c);
  if (!A[a]) {
    S.erase(a);
    return;
  }
  int q = A[b] / A[a];
  for (int i = (0); i <= (20); ++i) {
    if (q & 1)
      A[b] -= A[a], A[a] <<= 1, ans.push_back((make_pair(a, b)));
    else if (q)
      A[c] -= A[a], A[a] <<= 1, ans.push_back((make_pair(a, c)));
    q >>= 1;
  }
  merge(a, b, c);
}
int main() {
  scanf("%d", &N);
  for (int i = (1); i <= (N); ++i) {
    scanf("%d", &x);
    A[++n] = x;
    if (x) S.insert(i);
  }
  if (S.size() < 2)
    puts("-1");
  else if (S.size() == 2)
    puts("0");
  else {
    while (S.size() > 2) {
      set<int>::iterator itr = S.begin();
      int a = *itr;
      ++itr;
      int b = *itr;
      ++itr;
      int c = *itr;
      merge(a, b, c);
    }
    printf("%d\n", ans.size());
    for (int i = (0); i < (ans.size()); ++i)
      printf("%d %d\n", ans[i].first, ans[i].second);
  }
  return 0;
}
