#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  vector<pair<long long, long long>> res;
  vector<bool> flag(n, false);
  queue<long long> one;
  queue<long long> all;
  for (long long i = n - 1; i >= 0; i--) {
    if (a[i] == 1) {
      one.push(i);
      flag[i] = true;
    } else if (a[i] == 2) {
      if (one.empty()) {
        cout << -1;
        return;
      }
      flag[i] = true;
      long long cur = one.front();
      one.pop();
      flag[cur] = false;
      res.push_back({i, cur});
      all.push(i);
    } else if (a[i] == 3) {
      if (one.empty() && all.empty()) {
        cout << -1;
        return;
      }
      flag[i] = true;
      long long cur;
      if (all.empty()) {
        cur = one.front();
        one.pop();
      } else {
        cur = all.front();
        all.pop();
      }
      res.push_back({i, cur});
      all.push(i);
    }
  }
  for (long long i = 0; i < n; i++) {
    if (flag[i]) res.push_back({i, i});
  }
  cout << res.size() << "\n";
  for (auto x : res) {
    cout << x.first + 1 << " " << x.second + 1 << "\n";
  }
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  cout << setprecision(12);
  while (t--) {
    solve();
  }
  cerr << "Time Taken : " << (float)clock() / CLOCKS_PER_SEC << " secs"
       << "\n";
}
