#include <bits/stdc++.h>
using namespace std;
long long int q, n;
long long int sum, ans;
long long int gcd(long long int a, long long int b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
long long int powe(long long int a, long long int b) {
  long long int res = 1;
  while (b > 0) {
    if (b % 2 == 1) {
      res = (res * a);
    }
    a = (a * a);
    b /= 2;
  }
  return res;
}
void the_happiest_place_on_earth() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
}
const int N = 300040;
long long int a[N], b[N], p[N], par[N], Size[N], present[N], color[N];
void testcase() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  vector<pair<long long int, long long int>> ans;
  vector<long long int> v1, v2;
  int cnt = 0;
  for (int i = n; i >= 1; --i) {
    if (a[i] == 1) {
      ans.push_back({i, p[i] = ++cnt});
      v1.push_back(i);
    } else if (a[i] == 2) {
      if (v1.empty()) {
        cout << "-1\n";
        return;
      }
      int x = v1.back();
      v1.pop_back();
      ans.push_back({i, p[i] = p[x]});
      v2.push_back(i);
    } else if (a[i] == 3) {
      int x = -114514;
      if (!v2.empty()) {
        x = v2.back();
        v2.pop_back();
      } else if (!v1.empty()) {
        x = v1.back();
        v1.pop_back();
      }
      if (x < 0) {
        cout << "-1\n";
        return;
      }
      p[i] = ++cnt, ans.push_back({i, cnt}), ans.push_back({x, cnt});
      v2.push_back(i);
    }
  }
  cout << ans.size() << "\n";
  for (auto it : ans) cout << n - it.second + 1 << " " << it.first << "\n";
  return;
}
int main() {
  the_happiest_place_on_earth();
  the_happiest_place_on_earth();
  q = 1;
  int t = 0;
  while (q--) {
    testcase();
  }
  return 0;
}
