#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, tmp;
  cin >> n;
  vector<pair<int, int>> ans;
  vector<stack<int>> left(2, stack<int>());
  int cur = 1;
  for (int i = 1; i <= n; i++) {
    cin >> tmp;
    switch (tmp) {
      case 0:
        break;
      case 1:
        if (left[0].size()) {
          ans.emplace_back(cur, left[0].top());
          ans.emplace_back(cur++, i), left[0].pop();
        } else if (left[1].size()) {
          ans.emplace_back(cur, left[1].top());
          ans.emplace_back(cur++, i), left[1].pop();
          ans.emplace_back(cur++, i);
        } else
          ans.emplace_back(cur++, i);
        break;
      case 2:
        if (left[1].size())
          ans.emplace_back(cur, left[1].top()), ans.emplace_back(cur++, i),
              left[1].pop();
        left[0].push(i);
        break;
      case 3:
        if (left[1].size())
          ans.emplace_back(cur, left[1].top()), ans.emplace_back(cur++, i),
              left[1].pop();
        left[1].push(i);
        break;
    }
  }
  if (left[0].size() + left[1].size() || cur > n + 1) {
    cout << -1;
    return 0;
  }
  cout << ans.size() << '\n';
  for (const auto& [a, b] : ans) cout << a << ' ' << b << '\n';
  return 0;
}
