#include <bits/stdc++.h>
using namespace std;
namespace {
const int maxN = 1e6 + 5;
int n, hit[maxN];
int ansX[maxN], ansY[maxN], cnt;
int hit2[maxN], top2;
int hit3[maxN], top3;
void Solve() {
  cin >> n, cnt = top2 = top3 = 0;
  for (int x = 1; x <= n; x++) cin >> hit[x];
  for (int x = 1, y = n; x <= n && cnt >= 0; x++) {
    if (hit[x] == 1) {
      if (top2)
        ansX[++cnt] = x, ansY[cnt] = hit2[top2--];
      else if (top3) {
        if (y <= 0) cnt = -100;
        ansX[++cnt] = x, ansY[cnt] = hit3[top3--], ansX[++cnt] = x,
        ansY[cnt] = y--;
      } else {
        if (y <= 0) cnt = -100;
        ansX[++cnt] = x, ansY[cnt] = y--;
      }
    } else if (hit[x] == 2) {
      if (top3) {
        if (y <= 0) cnt = -100;
        ansX[++cnt] = x, ansY[cnt] = hit3[top3--], ansX[++cnt] = x,
        ansY[cnt] = y--;
      } else {
        if (y <= 0) cnt = -100;
        ansX[++cnt] = x, ansY[cnt] = y--;
      }
      hit2[++top2] = y + 1;
    } else if (hit[x] == 3) {
      if (top3) {
        if (y <= 0) cnt = -100;
        ansX[++cnt] = x, ansY[cnt] = hit3[top3--], ansX[++cnt] = x,
        ansY[cnt] = y--;
      } else {
        if (y <= 0) cnt = -100;
        ansX[++cnt] = x, ansY[cnt] = y--;
      }
      hit3[++top3] = y + 1;
    }
  }
  if (cnt >= 0 && !top2 && !top3) {
    cout << cnt << endl;
    for (int i = 1; i <= cnt; i++)
      cout << n - ansY[i] + 1 << ' ' << ansX[i] << endl;
  } else
    cout << -1 << endl;
}
}  // namespace
int main() {
  ios::sync_with_stdio(false), cin.tie(nullptr);
  int t(1);
  while (t--) Solve();
  return 0;
}
