#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
const int mod = 1e9 + 7;
int a[N];
int row[N], col[N];
int stc[N], top;
bool vis[N];
vector<pair<int, int> > res;
void solve() {
  int n;
  scanf("%d", &n);
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (a[i] == 2) cnt++;
  }
  int t = n;
  for (int i = 1; i <= n; i++) {
    if (a[i] == 2)
      stc[++top] = i;
    else if (a[i] == 1) {
      if (top) {
        int x = stc[top--];
        row[t] += 2;
        res.push_back({t, x});
        res.push_back({t, i});
        vis[i] = true;
        t--;
      } else {
        row[t]++;
        res.push_back({t, i});
        t--;
      }
    }
  }
  if (top) {
    puts("-1");
    return;
  }
  t = n;
  int p = n;
  for (int i = n; i; i--) {
    if (a[i] == 3) {
      while (!a[p] || (a[p] == 1 && vis[p])) p--;
      if (p <= i) {
        puts("-1");
        return;
      }
      while (t >= 1) {
        if (row[t] == 0) {
          res.push_back({t, p});
          res.push_back({t, i});
          row[t] += 2;
          break;
        } else
          t--;
      }
      p--;
    }
  }
  printf("%d\n", res.size());
  for (int i = 0; i < res.size(); i++) {
    printf("%d %d\n", res[i].first, res[i].second);
  }
}
signed main() {
  solve();
  return 0;
}
