#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int a[N], x[N << 1], y[N << 1];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  int cnt = 0;
  stack<int> st1, st2;
  bool flag = 1;
  for (int i = n; i >= 1; --i) {
    if (a[i] == 1) st1.push(i);
    if (a[i] == 2) {
      x[++cnt] = i, y[cnt] = i;
      st2.push(i);
      if (!st1.empty()) {
        int top = st1.top();
        st1.pop();
        x[++cnt] = i, y[cnt] = top;
      } else {
        flag = 0;
        break;
      }
    }
    if (a[i] == 3) {
      x[++cnt] = i, y[cnt] = i;
      if (!st2.empty()) {
        int top = st2.top();
        st2.pop();
        x[++cnt] = i, y[cnt] = top;
        st2.push(i);
      } else if (!st1.empty()) {
        int top = st1.top();
        st1.pop();
        x[++cnt] = i, y[cnt] = top;
        x[++cnt] = top, y[cnt] = top;
        st2.push(i);
      } else {
        flag = 0;
        break;
      }
    }
  }
  if (!flag) {
    printf("-1\n");
    return 0;
  }
  while (!st1.empty()) {
    int top = st1.top();
    st1.pop();
    x[++cnt] = top, y[cnt] = top;
  }
  printf("%d\n", cnt);
  for (int i = 1; i <= cnt; ++i) printf("%d %d\n", x[i], y[i]);
  return 0;
}
