#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, fl = 0;
  cin >> n;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) cin >> a[i];
  queue<int> q, q1;
  vector<pair<int, int>> ans;
  unordered_map<int, int> mp;
  int start = n;
  for (int i = n; i > 0; i--) {
    if (a[i] == 1) {
      q.push(i);
      ans.push_back({start, i});
      mp[i] = start;
      start--;
    } else if (a[i] == 2) {
      if (q.empty()) {
        cout << -1 << "\n";
        return;
      }
      int temp = q.front();
      q.pop();
      ans.push_back({mp[temp], i});
      q1.push(i);
      mp[i] = mp[temp];
    } else if (a[i] == 3) {
      if (q.empty() && q1.empty()) {
        cout << -1 << "\n";
        return;
      }
      if (!q1.empty()) {
        int temp = q1.front();
        q1.pop();
        ans.push_back({start, i});
        ans.push_back({start, temp});
        mp[i] = start;
        q1.push(i);
        start--;
      } else {
        int temp = q.front();
        q.pop();
        ans.push_back({start, i});
        ans.push_back({start, temp});
        mp[i] = start;
        q1.push(i);
        start--;
      }
    }
  }
  cout << ans.size() << "\n";
  for (auto i : ans) cout << i.first << " " << i.second << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  t = 1;
  while (t--) {
    solve();
  }
}
