#include <bits/stdc++.h>
using namespace std;
int a[100000];
void run_case() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  deque<pair<pair<int, int>, bool>> aval;
  int ct = n - 1;
  vector<pair<int, int>> ans;
  for (int i = n - 1; i >= 0; i--) {
    if (a[i] == 1) {
      if (ct < 0) {
        cout << "-1\n";
        return;
      }
      aval.push_front({{i, ct}, true});
      ans.push_back({ct, i});
      ct--;
    } else if (a[i] == 2) {
      if (aval.empty()) {
        cout << "-1\n";
        return;
      }
      auto cur = aval.front();
      if (!cur.second) {
        cout << "-1\n";
        return;
      }
      aval.pop_front();
      ans.push_back({cur.first.second, i});
      aval.push_back({{i, cur.first.second}, false});
    } else if (a[i] == 3) {
      if (aval.empty() || ct < 0) {
        cout << "-1\n";
        return;
      }
      pair<int, int> cur = aval.back().first;
      aval.pop_back();
      ans.push_back({ct, i});
      ans.push_back({ct, cur.first});
      aval.push_back({{i, ct}, false});
      ct--;
    }
  }
  cout << ans.size() << '\n';
  for (pair<int, int> i : ans)
    cout << i.first + 1 << " " << i.second + 1 << '\n';
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  if (fopen("input.in", "r"))
    freopen("input.in", "r", stdin), freopen("output.out", "w", stdout);
  int t;
  t = 1;
  while (t--) {
    run_case();
  }
}
