#include <bits/stdc++.h>
using namespace std;
int N, A[300005];
stack<int> ones, twos, threes;
int match[9][300005];
bool processed[300005];
vector<pair<int, int> > ans;
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) scanf("%d", &A[i]);
  for (int i = N; i >= 1; i--) {
    if (A[i] == 1)
      ones.push(i);
    else if (A[i] == 2) {
      if (ones.empty()) {
        printf("-1");
        return 0;
      } else {
        match[A[i]][i] = ones.top();
        ones.pop();
      }
      twos.push(i);
    } else if (A[i] == 3) {
      if (threes.empty() == false)
        match[A[i]][i] = threes.top();
      else if (twos.empty() == false)
        match[A[i]][i] = twos.top();
      else if (ones.empty() == false) {
        match[A[i]][i] = ones.top();
        ones.pop();
      } else {
        printf("-1");
        return 0;
      }
      threes.push(i);
    }
  }
  int currRow = 1;
  for (int i = 1; i <= N; i++) {
    if (A[i] == 0 || processed[i]) continue;
    int currAt = i;
    while (currAt > 0) {
      processed[currAt] = true;
      if (A[currAt] == 1) {
        ans.push_back(make_pair(currRow, currAt));
        currRow++;
        currAt = 0;
      } else if (A[currAt] == 2) {
        ans.push_back(make_pair(currRow, currAt));
        currAt = match[A[currAt]][currAt];
      } else if (A[currAt] == 3) {
        ans.push_back(make_pair(currRow, currAt));
        currAt = match[A[currAt]][currAt];
        ans.push_back(make_pair(currRow, currAt));
        currRow++;
      }
    }
  }
  sort(ans.begin(), ans.end());
  printf("%d\n", (int)(ans.size()));
  for (int i = 0; i < (int)(ans.size()); i++)
    printf("%d %d\n", ans[i].first, ans[i].second);
}
