#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> v(n + 1);
  for (int i = 1; i <= n; i++) cin >> v[i];
  vector<pair<int, int>> res;
  vector<int> twos;
  vector<int> threes;
  for (int x = 1; x <= n; x++) {
    if (v[x] == 1) {
      if (twos.size() > 0) {
        int last = twos[twos.size() - 1];
        twos.pop_back();
        res.push_back({last, last});
        res.push_back({x, last});
      } else if (threes.size() > 0) {
        int last = threes[threes.size() - 1];
        threes.pop_back();
        res.push_back({last, last});
        res.push_back({x, last});
        res.push_back({x, x});
      } else {
        res.push_back({x, x});
      }
    } else if (v[x] == 2) {
      twos.push_back(x);
      if (threes.size() > 0) {
        int last = threes[threes.size() - 1];
        threes.pop_back();
        res.push_back({last, last});
        res.push_back({x, last});
      }
    } else if (v[x] == 3) {
      if (threes.size() > 0) {
        int last = threes[threes.size() - 1];
        threes.pop_back();
        res.push_back({last, last});
        res.push_back({x, last});
      }
      threes.push_back(x);
    }
  }
  if (twos.size() > 0 || threes.size() > 0) {
    cout << "-1\n";
  } else {
    cout << res.size() << "\n";
    for (auto p : res) {
      cout << p.second << " " << p.first << "\n";
    }
  }
  return 0;
}
