#include <bits/stdc++.h>
using namespace std;
const int MAX = 1014;
pair<int, int> v[MAX];
vector<pair<int, int> > ans;
pair<int, int> BG, CG;
inline void solve(pair<int, int> A, pair<int, int> B, pair<int, int> C) {
  if (A.first > B.first) {
    swap(A, B);
  }
  if (A.first > C.first) {
    swap(A, C);
  }
  if (B.first > C.first) {
    swap(B, C);
  }
  if (A.first == 0) {
    BG = B;
    CG = C;
    return;
  }
  int cat = B.first / A.first;
  for (int put = 1; put <= cat; put <<= 1) {
    if (put & cat) {
      ans.push_back({A.second, B.second});
      B.first -= A.first;
      A.first <<= 1;
    } else {
      ans.push_back({A.second, C.second});
      C.first -= A.first;
      A.first <<= 1;
    }
  }
  solve(A, B, C);
}
int main() {
  ios ::sync_with_stdio(false);
  int n, zeroes = 0;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> v[i].first;
    zeroes += (v[i].first == 0);
    v[i].second = i;
  }
  if (zeroes > n - 2) {
    cout << -1 << '\n';
    return 0;
  }
  sort(v + 1, v + n + 1);
  int ii = 1;
  while (!v[ii].first) ++ii;
  for (int i = ii; i <= n - 2; ++i) {
    solve(v[i], v[i + 1], v[i + 2]);
    v[i + 1] = BG;
    v[i + 2] = CG;
  }
  cout << ans.size() << '\n';
  for (auto x : ans) cout << x.first << ' ' << x.second << '\n';
  return 0;
}
