#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  long long h = n, prev = 0, x;
  vector<pair<long long, long long> > ans;
  bool o = 1;
  stack<long long> s2;
  stack<pair<long long, long long> > prevs;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (x == 0) continue;
    if (x == 1 && !s2.empty()) {
      long long y = s2.top();
      s2.pop();
      ans.push_back({i + 1, y});
    } else if (!prevs.empty()) {
      prev = prevs.top().first;
      long long y = prevs.top().second;
      prevs.pop();
      if (prev == 3) {
        ans.push_back({i + 1, y});
        ans.push_back({i + 1, h});
      }
    } else {
      ans.push_back({i + 1, h});
    }
    h--;
    if (x == 2) {
      s2.push(h + 1);
    } else if (x == 3) {
      prevs.push({x, h + 1});
    }
  }
  if (!prevs.empty() || !s2.empty())
    cout << "-1\n";
  else {
    cout << ans.size() << "\n";
    for (auto it : ans) {
      cout << n - it.second + 1 << " " << it.first << "\n";
    }
  }
}
