#include <bits/stdc++.h>
using namespace std;
void test() {
  long long n, c = 0, kk = 0, b = 0;
  cin >> n;
  bool ok = true;
  long long a[n];
  queue<long long> two, three;
  vector<long long> v1(4, 0);
  vector<pair<long long, long long> > v;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] == 3 && ok == true)
      kk++, ok = false;
    else if (a[i] == 2)
      b++, kk = 0, ok = true;
    else if (a[i] == 1 && b > 0)
      b--;
    else if (a[i] == 1 && kk > 0)
      kk--, ok = true;
    ;
  }
  if (kk > 0 || b > 0) {
    cout << -1 << endl;
    return;
  }
  long long row = 1;
  for (long long col = 0; col < n; col++) {
    if (a[col] == 2) {
      if (three.size() > 0) {
        v.push_back({three.front(), col + 1});
        three.pop();
        v.push_back({three.front(), col + 1});
        two.push(three.front());
        three.pop();
        continue;
      }
      v.push_back({row, col + 1});
      two.push(row);
      row++;
    } else if (a[col] == 3) {
      if (three.size() > 0) {
        v.push_back({three.front(), col + 1});
        three.pop();
        v.push_back({three.front(), col + 1});
        three.push(row);
        row++;
        continue;
      }
      v.push_back({row, col + 1});
      three.push(row);
      row++;
      three.push(row);
      row++;
    } else if (a[col] == 1) {
      if (two.size()) {
        v.push_back({two.front(), col + 1});
        two.pop();
      } else if (three.size() > 0) {
        v.push_back({three.front(), col + 1});
        three.pop();
        v.push_back({three.front(), col + 1});
        three.pop();
      } else {
        v.push_back({row, col + 1});
        row++;
      }
    }
  }
  cout << v.size() << endl;
  for (long long i = 0; i < v.size(); i++)
    cout << v[i].first << " " << v[i].second << endl;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long t = 1;
  while (t--) {
    test();
  }
  return 0;
}
