#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, t;
int a[N];
vector<int> ones, twos, threes;
int he[N];
vector<pair<int, int> > ps;
void solve() {
  cin >> n;
  int cnt = 0;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = n - 1; i >= 0; i--) {
    if (a[i] == 1) {
      ones.push_back(i);
      ps.push_back({i, cnt});
      he[i] = cnt++;
    } else if (a[i] == 2) {
      if (ones.size() == 0) {
        cout << -1 << endl;
        return;
      }
      int j = ones.back();
      ones.pop_back();
      twos.push_back(i);
      ps.push_back({i, he[j]});
    } else if (a[i] == 3) {
      int j = -1;
      if (threes.size() > 0) {
        j = threes.back();
        threes.pop_back();
      } else if (twos.size() > 0) {
        j = twos.back();
        twos.pop_back();
      } else if (ones.size()) {
        j = ones.back();
        ones.pop_back();
      } else {
        cout << -1 << endl;
        return;
      }
      threes.push_back(i);
      ps.push_back({i, cnt});
      ps.push_back({j, cnt});
      cnt++;
    }
  }
  cout << ps.size() << endl;
  for (auto m : ps) {
    cout << n - m.second << " " << m.first + 1 << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
