#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long f = 1, x = 0;
  char s = getchar();
  while (s < '0' || s > '9') {
    if (s == '-') f = -f;
    s = getchar();
  }
  while (s >= '0' && s <= '9') {
    x = x * 10 + (s - '0');
    s = getchar();
  }
  return f * x;
}
const int MOD = 1000000007;
int n, m, i, j, s, o, k;
int a[100005], pre[100005], r[100005];
queue<int> q, q2;
int X[100005 << 1], Y[100005 << 1], cnt;
int main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    a[i] = read();
    r[i] = i;
  }
  bool flag = 1;
  for (int i = n; i > 0; i--) {
    if (a[i] == 1) {
      q.push(i);
    } else if (a[i] == 2) {
      if (q.empty()) {
        flag = 0;
        break;
      }
      int j = q.front();
      q.pop();
      pre[j] = i;
      q2.push(i);
    } else if (a[i] == 3) {
      if (q.empty() && q2.empty()) {
        flag = 0;
        break;
      }
      int j;
      if (!q2.empty())
        j = q2.front(), q2.pop();
      else
        j = q.front(), q.pop();
      pre[j] = i;
      q2.push(i);
    }
  }
  if (!flag) {
    printf("-1\n");
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    if (a[i]) {
      if (pre[i]) {
        if (a[pre[i]] == 3) {
          s = r[pre[i]], o = i;
          X[++cnt] = s;
          Y[cnt] = o;
        } else {
          r[i] = r[pre[i]];
        }
      }
      s = r[i];
      o = i;
      X[++cnt] = s;
      Y[cnt] = o;
    }
  }
  printf("%d\n", cnt);
  for (int i = 1; i <= cnt; i++) {
    printf("%d %d\n", X[i], Y[i]);
  }
  return 0;
}
