#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> v(n);
  for (auto &first : v) cin >> first;
  vector<pair<int, int> > ans;
  int last = 0;
  vector<int> cur;
  vector<bool> used(n, false);
  for (int i = 0; i < n; ++i) {
    if (v[i] == 1 || v[i] == 2) {
      if (cur.size() && v[cur.back()] == 2 && v[i] == 1) {
        used[i] = true;
        ans.push_back(make_pair(last, i));
        ans.push_back(make_pair(last, cur.back()));
        last++;
        cur.pop_back();
      } else
        cur.push_back(i);
    }
  }
  if (cur.size()) {
    if (v[cur.back()] == 2) {
      cout << -1;
      exit(0);
    }
    for (auto t : cur) {
      ans.push_back(make_pair(last, t));
      last++;
    }
  }
  vector<int> can_use;
  for (int i = n - 1; i >= 0; i--) {
    if (v[i] == 3) {
      if (!can_use.size()) {
        cout << -1;
        exit(0);
      }
      int kek = can_use.back();
      can_use.pop_back();
      ans.push_back(make_pair(last, i));
      ans.push_back(make_pair(last, kek));
      last++;
    }
    if (v[i] != 0 && !used[i]) can_use.push_back(i);
  }
  cout << ans.size() << '\n';
  for (auto first : ans)
    cout << n - first.first << " " << first.second + 1 << '\n';
}
