#include <bits/stdc++.h>
using namespace std;
int dx[] = {+1, -1, 0, 0};
int dy[] = {0, 0, +1, -1};
int n, a[1000005];
int cnt[5];
bool vis[1000005];
vector<int> ansR, ansC;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  bool flag = true;
  int up = 0;
  for (int i = 1, j = 1, k = 1; i <= n && flag; i++) {
    if (a[i] == 3) {
      while (j <= n && (j <= i || a[j] == 0 || vis[j])) ++j;
      if (j > n)
        flag = false;
      else if (a[j] == 1) {
        ++up;
        ansR.push_back(up);
        ansC.push_back(i);
        ansR.push_back(up);
        ansC.push_back(j);
        ++up;
        ansR.push_back(up);
        ansC.push_back(j);
        vis[j] = true;
      } else {
        ++up;
        ansR.push_back(up);
        ansC.push_back(i);
        ansR.push_back(up);
        ansC.push_back(j);
      }
    } else if (a[i] == 2) {
      while (k <= n && (k <= i || a[k] != 1 || vis[k])) ++k;
      if (k > n)
        flag = false;
      else {
        ++up;
        ansR.push_back(up);
        ansC.push_back(i);
        ansR.push_back(up);
        ansC.push_back(k);
        vis[k] = true;
      }
    } else if (a[i] == 1 && !vis[i]) {
      ++up;
      ansR.push_back(up);
      ansC.push_back(i);
      vis[i] = true;
    }
  }
  if (up > n) flag = false;
  if (flag) {
    int ans = ansC.size();
    cout << ans << endl;
    for (int i = 0; i < ans; i++) cout << ansR[i] << " " << ansC[i] << endl;
  } else
    cout << "-1" << endl;
  return 0;
}
