#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
const int MAXINT = 1073741823;
int a[MAXN];
int next_of[MAXN];
int to_add[MAXN];
bool is_three[MAXN];
set<int> ones;
set<int> twos;
set<int> threes;
set<pair<int, int>> answer;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = n; i >= 1; i--) {
    if (a[i] == 1)
      ones.insert(i);
    else if (a[i] == 2) {
      if (ones.empty()) {
        cout << -1;
        return 0;
      }
      next_of[i] = *ones.begin();
      ones.erase(ones.begin());
      twos.insert(i);
    } else if (a[i] == 3) {
      if (twos.empty() && threes.empty()) {
        if (ones.empty()) {
          cout << -1;
          return 0;
        }
        next_of[i] = *ones.begin();
        ones.erase(ones.begin());
      } else if (!twos.empty()) {
        next_of[i] = *twos.begin();
        twos.erase(twos.begin());
      } else {
        next_of[i] = *threes.begin();
        threes.erase(threes.begin());
      }
      threes.insert(i);
    }
  }
  for (int i = 1; i <= n; i++) {
    if (to_add[i] != 0) answer.insert(make_pair(to_add[i], i));
    if (a[i] == 1 && (to_add[i] == 0 || is_three[i]))
      answer.insert(make_pair(i, i));
    else if (a[i] == 2) {
      answer.insert(make_pair(i, i));
      to_add[next_of[i]] = i;
    } else if (a[i] == 3) {
      answer.insert(make_pair(i, i));
      to_add[next_of[i]] = i;
      is_three[next_of[i]] = true;
    }
  }
  cout << answer.size() << '\n';
  for (pair<int, int> i : answer) cout << i.first << ' ' << i.second << '\n';
  return 0;
}
