#include <bits/stdc++.h>
using namespace std;
int a[100005];
set<pair<int, int> > ans;
set<pair<int, int> > ans2;
set<int, greater<int> > row[3];
set<pair<int, int>, greater<pair<int, int> > > column[3];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int k = 0; k < 3; k++) {
    row[k] = set<int, greater<int> >();
    column[k] = set<pair<int, int>, greater<pair<int, int> > >();
  }
  for (int i = 1; i <= n; i++) {
    row[0].insert(i);
    column[0].insert(pair<int, int>(a[i], i));
  }
  if (a[n] >= 2) {
    printf("-1");
    return 0;
  }
  for (int i = n; i >= 1; i--) {
    if (a[i] == 1) {
      if (row[0].empty()) {
        printf("-1");
        return 0;
      }
      int r = *row[0].begin();
      row[0].erase(r);
      row[1].insert(r);
      column[0].erase(pair<int, int>(a[i], i));
      column[1].insert(pair<int, int>(a[i], i));
      ans.insert(pair<int, int>(r, i));
      ans2.insert(pair<int, int>(i, r));
    } else if (a[i] == 2) {
      if (row[1].empty()) {
        printf("-1");
        return 0;
      }
      int r = *row[1].begin();
      row[1].erase(r);
      row[2].insert(r);
      int c = (*ans.lower_bound(pair<int, int>(r, -1))).second;
      assert(ans.count(pair<int, int>(r, c)));
      column[1].erase(pair<int, int>(a[c], c));
      column[2].insert(pair<int, int>(a[c], c));
      column[0].erase(pair<int, int>(a[i], i));
      column[1].insert(pair<int, int>(a[i], i));
      ans.insert(pair<int, int>(r, i));
      ans2.insert(pair<int, int>(i, r));
    } else if (a[i] == 3) {
      if (row[0].empty()) {
        printf("-1");
        return 0;
      }
      int r = *row[0].begin();
      if (column[1].empty()) {
        printf("-1");
        return 0;
      }
      int c = (*column[1].begin()).second;
      column[1].erase(pair<int, int>(a[c], c));
      column[2].insert(pair<int, int>(a[c], c));
      int r2 = (*ans2.lower_bound(pair<int, int>(c, -1))).second;
      assert(ans2.count(pair<int, int>(c, r2)));
      row[1].erase(r2);
      row[2].insert(r2);
      row[0].erase(r);
      row[2].insert(r);
      column[0].erase(pair<int, int>(a[i], i));
      column[1].insert(pair<int, int>(a[i], i));
      ans.insert(pair<int, int>(r, i));
      ans2.insert(pair<int, int>(i, r));
      ans.insert(pair<int, int>(r, c));
      ans2.insert(pair<int, int>(c, r));
    }
  }
  printf("%d\n", (int)ans.size());
  for (pair<int, int> temp : ans) {
    int r, c;
    tie(r, c) = temp;
    printf("%d %d\n", r, c);
  }
  return 0;
}
