#include <bits/stdc++.h>
template <class T>
bool chmin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}
template <class T>
bool chmax(T& a, const T& b) {
  return a < b ? a = b, 1 : 0;
}
using namespace std;
const int INF = INT_MAX;
const long long LNF = LONG_LONG_MAX;
inline int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
inline long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
inline int lcm(int a, int b) { return a * b / gcd(a, b); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    int n;
    cin >> n;
    int a[n];
    for (int i = int(0); i < int(n); ++i) cin >> a[i];
    vector<pair<int, int>> ans;
    int temp = n;
    vector<int> ones, others;
    vector<int> h(n);
    int nxt = n;
    for (int i = int(n - 1); i > int(-1); i--) {
      int cur = -1;
      if (a[i] == 2) {
        if (!ones.empty()) {
          cur = ones.back();
          ones.pop_back();
        } else {
          cout << -1 << '\n';
          return 0;
        }
        others.push_back(i);
      } else if (a[i] == 3) {
        if (!others.empty()) {
          cur = others.back();
          others.pop_back();
        } else {
          if (!ones.empty()) {
            cur = ones.back();
            ones.pop_back();
          } else {
            cout << -1 << '\n';
            return 0;
          }
        }
        others.push_back(i);
      } else if (a[i] == 1) {
        ones.push_back(i);
      }
      if (a[i] == 1) {
        assert(cur == -1);
        h[i] = nxt--;
        ans.emplace_back(h[i], i + 1);
      } else if (a[i] == 2) {
        h[i] = h[cur];
        ans.emplace_back(h[i], i + 1);
      } else if (a[i] == 3) {
        h[i] = nxt--;
        ans.emplace_back(h[i], cur + 1);
        ans.emplace_back(h[i], i + 1);
      }
    }
    cout << ans.size() << '\n';
    for (int i = int(0); i < int(ans.size()); ++i) {
      cout << ans[i].first << ' ' << ans[i].second << '\n';
    }
  }
  return 0;
}
