#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return {i, j};
}
struct printer {
  ~printer() { cerr << endl; }
  template <class c>
  printer& operator,(c x) {
    cerr << boolalpha << x;
    return *this;
  }
  printer& operator,(string x) {
    cerr << x;
    return *this;
  }
  template <class c, class d>
  printer& operator,(pair<c, d> x) {
    return *this, "(", x.first, ", ", x.second, ")";
  }
  template <class... d, template <class...> class c>
  printer& operator,(c<d...> x) {
    return *this, range(begin(x), end(x));
  }
  template <class c>
  printer& operator,(rge<c> x) {
    *this, "[";
    for (auto it = x.b; it != x.e; ++it) *this, (it == x.b ? "" : ", "), *it;
    return *this, "]";
  }
};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int my_rand(int l, int r) { return uniform_int_distribution<int>(l, r)(rng); }
void solve() {
  int n;
  cin >> n;
  vector<int> ar(n + 1);
  bool ok = 1;
  for (int i = 1; i <= n; i++) cin >> ar[i];
  vector<pair<int, int> > ans, one, two;
  int r = n;
  for (int i = n; i >= 1; i--) {
    if (ar[i] == 0) continue;
    if (ar[i] == 1) {
      ans.push_back({r, i});
      one.push_back(ans.back());
      r--;
    } else if (ar[i] == 2) {
      if (!one.size()) {
        ok = 0;
        break;
      }
      auto p = one.back();
      one.pop_back();
      ans.push_back({p.first, i});
      two.push_back(ans.back());
    } else {
      if (!(one.size() + two.size())) {
        ok = 0;
        break;
      }
      pair<int, int> p;
      if (two.size()) {
        p = two.back();
        two.pop_back();
      } else {
        p = one.back();
        one.pop_back();
      }
      ans.push_back({r, p.second});
      ans.push_back({r, i});
      two.push_back({ans.back()});
      r--;
    }
  }
  if (!ok)
    cout << -1 << "\n";
  else {
    cout << ans.size() << "\n";
    for (auto tp : ans) cout << tp.first << " " << tp.second << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) solve();
  return 0;
}
