#include <bits/stdc++.h>
using namespace std;
vector<int> g[4];
void kill() {
  cout << -1;
  exit(0);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) g[0].push_back(n - i);
  vector<pair<int, int> > res;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    if (x == 0) continue;
    if (x == 1) {
      for (int j = 3; j >= 0; j--) {
        if (g[j].size()) {
          int row = g[j].back();
          g[j].pop_back();
          res.emplace_back(row, i);
          if (j == 3) {
            if (g[0].empty()) kill();
            int row = g[0].back();
            g[0].pop_back();
            res.emplace_back(row, i);
          }
          break;
        }
      }
    } else {
      if (g[0].empty()) kill();
      int row = g[0].back();
      g[0].pop_back();
      res.emplace_back(row, i);
      if (g[3].size()) {
        int rowx = g[3].back();
        g[3].pop_back();
        res.emplace_back(rowx, i);
      }
      g[x].push_back(row);
    }
  }
  if (g[3].size() || g[2].size()) kill();
  cout << res.size() << endl;
  for (auto &x : res) cout << x.first << " " << x.second << '\n';
  return 0;
}
