#include <bits/stdc++.h>
int n, lst, a[100005], t, l1 = 1, r1, l2 = 1, r2, l3 = 1, r3;
struct Q {
  int x, y;
} ans[200005], q3[100005], q2[100005], q1[100005];
int main() {
  scanf("%d", &n);
  lst = 1;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = n; i; i--) {
    if (a[i] == 3) {
      if (l3 <= r3 && lst <= n) {
        ans[++t] = (Q){i, lst};
        q3[++r3] = ans[t];
        ans[++t] = (Q){q3[l3].x, lst};
        lst++;
        l3++;
      } else if (l1 <= r1 && lst <= n) {
        ans[++t] = (Q){i, lst};
        q3[++r3] = ans[t];
        ans[++t] = (Q){q1[l1].x, lst};
        lst++;
        l1++;
      } else {
        printf("-1\n");
        return 0;
      }
    } else if (a[i] == 2) {
      if (l2 <= r2) {
        ans[++t] = (Q){i, q2[l2].y};
        l2++;
        q3[++r3] = ans[t];
      } else if (l1 <= r1) {
        ans[++t] = (Q){i, q1[l1].y};
        l1++;
        q3[++r3] = ans[t];
      } else {
        printf("-1\n");
        return 0;
      }
    } else if (a[i] == 1) {
      if (lst <= n) {
        ans[++t] = (Q){i, lst};
        lst++;
        q1[++r1] = ans[t];
      } else {
        printf("-1\n");
        return 0;
      }
    }
  }
  printf("%d\n", t);
  for (int i = 1; i <= t; i++) printf("%d %d\n", n + 1 - ans[i].y, ans[i].x);
}
