#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e5;
int no() {
  puts("-1");
  return 0;
}
int dat[N + 5];
vector<pair<int, int> > res;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", dat + i);
  }
  dat[n + 1] = 0;
  queue<int> q[5];
  for (int idx = 0; idx < 5; idx++) {
    while (!q[idx].empty()) {
      q[idx].pop();
    }
  }
  res.clear();
  for (int i = n; i >= 1; i--) {
    if (dat[i] == 1) {
      res.push_back(make_pair(i, i));
      q[1].push(i);
    } else if (dat[i] == 2) {
      int idx = -1;
      if (!q[1].empty()) {
        idx = q[1].front();
        q[1].pop();
      }
      if (idx == -1) return no();
      res.push_back(make_pair(idx, i));
      q[2].push(i);
    } else if (dat[i] == 3) {
      int idx = -1;
      if (!q[2].empty()) {
        idx = q[2].front();
        q[2].pop();
      } else if (!q[1].empty()) {
        idx = q[1].front();
        q[1].pop();
      }
      if (idx == -1) return no();
      res.push_back(make_pair(i, i));
      res.push_back(make_pair(i, idx));
      q[2].push(i);
    }
  }
  printf("%d\n", (int)res.size());
  for (pair<int, int> x : res) {
    printf("%d %d\n", x.first, x.second);
  }
  return 0;
}
