#include <bits/stdc++.h>
int main() {
  using namespace std;
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int> a = vector<int>(n);
  for (int& ai : a) cin >> ai;
  struct Pt {
    int r, c;
  };
  vector<Pt> pts;
  vector<int> singles;
  vector<int> duples;
  for (int i = n - 1; i >= 0; --i) {
    int ai = a[i];
    switch (ai) {
      case 0:
        continue;
      case 1:
        pts.push_back(Pt{i + 1, i + 1});
        singles.push_back(i);
        continue;
      case 2: {
        if (singles.empty()) {
          cout << "-1\n";
          return 0;
        }
        int currTarCol = singles.back();
        singles.pop_back();
        pts.push_back(Pt{currTarCol + 1, i + 1});
        duples.push_back(i);
        continue;
      }
      case 3: {
        int currTarCol;
        if (!duples.empty()) {
          currTarCol = duples.back();
          duples.pop_back();
        } else if (!singles.empty()) {
          currTarCol = singles.back();
          singles.pop_back();
        } else {
          cout << "-1\n";
          return 0;
        }
        pts.push_back(Pt{i + 1, i + 1});
        pts.push_back(Pt{i + 1, currTarCol + 1});
        duples.push_back(i);
        continue;
      }
      default:
        cerr << "yikes\n";
        return 1;
    }
  }
  cout << pts.size() << '\n';
  for (Pt pt : pts) cout << pt.r << ' ' << pt.c << '\n';
  return 0;
}
