#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  vector<pair<int, int> > res;
  vector<int> lel(n, -1);
  int curr = n;
  set<int> ones;
  set<int> twos;
  int three = -1;
  for (int i = n - 1; i >= 0; i--) {
    int need = v[i];
    if (need == 0) {
    } else if (need == 1) {
      curr--;
      lel[i] = curr;
      res.push_back({curr, i});
      ones.insert(i);
    } else if (need == 2) {
      if (ones.empty()) {
        cout << -1 << endl;
        return;
      }
      auto it = ones.begin();
      int j = *it;
      ones.erase(it);
      int l = lel[j];
      lel[i] = l;
      res.push_back({l, i});
      twos.insert(i);
    } else {
      curr--;
      if (three != -1) {
        int j = three;
        res.push_back({curr, i});
        res.push_back({curr, j});
        three = i;
      } else {
        if (twos.empty()) {
          if (ones.empty()) {
            cout << -1 << endl;
            return;
          }
          auto it = ones.begin();
          int j = *it;
          ones.erase(it);
          res.push_back({curr, i});
          res.push_back({curr, j});
          three = i;
        } else {
          auto it = twos.begin();
          int j = *it;
          twos.erase(it);
          res.push_back({curr, i});
          res.push_back({curr, j});
          three = i;
        }
      }
    }
  }
  cout << res.size() << "\n";
  for (auto p : res) {
    cout << p.first + 1 << " " << p.second + 1 << "\n";
  }
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int T = 1;
  for (int t = 0; t < T; t++) {
    solve();
  }
  return 0;
}
