#include <bits/stdc++.h>
using namespace std;
int n, t, x, a[100005], cnt, ans;
vector<int> v[100005];
stack<int> st1, st2;
pair<int, int> c[200005];
signed main() {
  cin >> n;
  cnt = n + 1;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = n; i >= 1; i--) {
    if (a[i] == 0) continue;
    if (a[i] == 1) {
      st1.push(i);
      v[i].push_back(--cnt);
    }
    if (a[i] == 2) {
      if (st1.empty()) puts("-1"), exit(0);
      v[i].push_back(v[st1.top()][0]);
      st1.pop();
      st2.push(i);
    }
    if (a[i] == 3) {
      if (st2.empty() && st1.empty()) puts("-1"), exit(0);
      if (st2.empty()) {
        v[i].push_back(--cnt);
        v[st1.top()].push_back(cnt);
        st1.pop();
        st2.push(i);
      } else {
        v[i].push_back(--cnt);
        v[st2.top()].push_back(cnt);
        st2.pop();
        st2.push(i);
      }
    }
  }
  for (int i = 1; i <= n; i++)
    for (int j = 0; j < v[i].size(); j++) c[++ans] = make_pair(v[i][j], i);
  sort(c + 1, c + ans + 1);
  printf("%d\n", ans);
  for (int i = 1; i <= ans; i++) printf("%d %d\n", c[i].first, c[i].second);
}
