#include <bits/stdc++.h>
using namespace std;
void NO() {
  puts("-1");
  exit(0);
}
int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  vector<int> ones;
  vector<int> others;
  vector<pair<int, int>> answer;
  vector<int> h(n);
  int nxt = n;
  for (int i = n - 1; i >= 0; --i) {
    int pair = -1;
    if (a[i] == 2) {
      if (ones.empty()) {
        NO();
      }
      pair = ones.back();
      ones.pop_back();
    } else if (a[i] == 3) {
      if (!others.empty()) {
        pair = others.back();
        others.pop_back();
      } else {
        if (ones.empty()) {
          NO();
        }
        pair = ones.back();
        ones.pop_back();
      }
    }
    if (a[i] == 1) {
      ones.push_back(i);
    }
    if (a[i] >= 2) {
      others.push_back(i);
    }
    if (a[i] == 1) {
      assert(pair == -1);
      h[i] = nxt--;
      answer.emplace_back(h[i], i + 1);
    } else if (a[i] == 2) {
      h[i] = h[pair];
      answer.emplace_back(h[i], i + 1);
    } else if (a[i] == 3) {
      h[i] = nxt--;
      answer.emplace_back(h[i], pair + 1);
      answer.emplace_back(h[i], i + 1);
    }
  }
  printf("%d\n", (int)answer.size());
  for (pair<int, int> p : answer) {
    printf("%d %d\n", p.first, p.second);
  }
}
