#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000 + 10;
int n, a[MAXN];
vector<pair<int, int> > Tohka;
void R(int &a, int &b, int ai, int bi) {
  if (a <= b)
    b -= a, a *= 2, Tohka.push_back(make_pair(ai, bi));
  else
    a -= b, b *= 2, Tohka.push_back(make_pair(bi, ai));
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    int first;
    scanf("%d", &first);
    a[i] = first;
  }
  int A = 0, B = 1, C = 2;
  for (int i = 3; i <= n; ++i)
    for (A = i;;) {
      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]) break;
      for (int j = a[B] / a[A]; j >= 1; j >>= 1)
        if (j & 1)
          R(a[A], a[B], A, B);
        else
          R(a[A], a[C], A, C);
    }
  if (!a[A] + !a[B] + !a[C] != 1) puts("-1"), exit(0);
  cout << Tohka.size() << endl;
  for (int i = 0; i < (int)Tohka.size(); ++i)
    printf("%d %d\n", Tohka[i].first, Tohka[i].second);
  fclose(stdin);
  fclose(stdout);
  return 0;
}
