#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int a[maxn], a1[maxn], a2[maxn];
int h[maxn], n, t1, t2;
vector<pair<int, int> > ans;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int ch = n + 1;
  for (int i = n; i >= 1; i--) {
    if (a[i] == 1) {
      h[i] = --ch;
      a1[++t1] = i;
      ans.push_back({i, h[i]});
    } else if (a[i] == 2) {
      if (!t1) {
        cout << -1;
        return 0;
      }
      h[i] = h[a1[t1--]];
      a2[++t2] = i;
      ans.push_back({i, h[i]});
    } else if (a[i] == 3) {
      if (!t1 && !t2) {
        cout << -1;
        return 0;
      }
      h[i] = --ch;
      ans.push_back({i, h[i]});
      int j;
      if (t2) {
        j = a2[t2--];
      } else {
        j = a1[t1--];
      }
      ans.push_back({j, h[i]});
      a2[++t2] = i;
    }
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++)
    cout << ans[i].second << " " << ans[i].first << endl;
  return 0;
}
