#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int N = 1e5 + 10;
const int mod = 1e9 + 7;
vector<int> a;
int main() {
  int n;
  scanf("%d", &n);
  a.resize(n + 5);
  vector<pair<int, int> > ans;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  set<int> mts, thrs;
  bool flag = 1;
  for (int i = n; i > 0; i--) {
    if (a[i] == 1) {
      ans.push_back({n - i + 1, i});
      mts.insert(i);
      thrs.insert(i);
    } else if (a[i] == 2) {
      if (mts.empty()) {
        flag = 0;
        break;
      }
      auto x = *mts.begin();
      mts.erase(x), thrs.erase(x);
      ans.push_back({n - x + 1, i});
      thrs.insert(i);
    } else if (a[i] == 3) {
      if (thrs.empty()) {
        flag = 0;
        break;
      }
      auto x = *thrs.begin();
      mts.erase(x), thrs.erase(x);
      ans.push_back({n - i + 1, x});
      ans.push_back({n - i + 1, i});
      thrs.insert(i);
    }
  }
  if (flag) {
    printf("%d\n", ans.size());
    for (auto x : ans) printf("%d %d\n", n - x.first + 1, x.second);
  } else
    printf("-1\n");
  return 0;
}
