#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T &x) {
  x = 0;
  int f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + (ch ^ 48);
    ch = getchar();
  }
  return x *= f, void();
}
template <typename T>
void ckmax(T &a, T b) {
  a = b > a ? b : a;
}
template <typename T>
void ckmin(T &a, T b) {
  a = b < a ? b : a;
}
const int N = 1e5 + 5;
int n, a[N], row[N], vis[N], rowcnt;
vector<pair<int, int> > ans;
int main() {
  read(n);
  for (int i = 1; i <= n; i++) {
    read(a[i]);
  }
  for (int i = 1; i <= n; i++) {
    if (a[i] == 1) {
      row[i] = ++rowcnt;
      ans.push_back(make_pair(row[i], i));
    }
  }
  int pos = 1;
  for (int i = 1; i <= n; i++) {
    if (a[i] == 2) {
      ckmax(pos, i);
      while (pos <= n && a[pos] != 1) {
        pos++;
      }
      if (pos == n + 1) {
        puts("-1");
        exit(0);
      }
      row[i] = row[pos];
      vis[pos] = true;
      ans.push_back(make_pair(row[i], i));
      pos++;
    }
  }
  pos = n;
  for (int i = n; i >= 1; i--) {
    if (a[i] == 3) {
      while (pos >= i && !((a[pos] == 1 && !vis[pos]) || a[pos] == 2 ||
                           (a[pos] == 3 && row[pos])))
        pos--;
      if (pos == i - 1) {
        puts("-1");
        exit(0);
      }
      row[i] = ++rowcnt;
      ans.push_back(make_pair(row[i], i));
      ans.push_back(make_pair(row[i], pos));
      pos--;
    }
  }
  if (rowcnt > n || (int)ans.size() > n * 2) {
    puts("-1");
    exit(0);
  }
  printf("%d\n", (int)ans.size());
  for (auto p : ans) {
    printf("%d %d\n", n - p.first + 1, p.second);
  }
  return 0;
}
