#include <bits/stdc++.h>
using namespace std;
vector<long long> fac(1e6);
long long p = 1e9 + 7;
long long gcd(long long x, long long y) {
  if (x == 0) {
    return y;
  }
  return gcd(y % x, x);
}
long long power(long long a, long long x) {
  long long ans = 1;
  while (x) {
    if (x & 1) {
      ans = (ans * a) % p;
    }
    x = x >> 1;
    a = (a * a) % p;
  }
  return ans;
}
long long modInv(long long a) { return power(a, p - 2); }
long long ncr(long long n, long long r) {
  long long ans = 1;
  if (r != 0 && r != n) {
    ans = fac[n] * modInv(fac[r]) % p * modInv(fac[n - r]) % p;
  }
  return ans;
}
void pre() {
  fac[0] = 1;
  for (int i = 1; i < (int)fac.size(); i++) {
    fac[i] = (fac[i - 1] * i) % p;
  }
}
void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto &i : a) {
    cin >> i;
  }
  vector<pair<int, int>> ans, one;
  vector<int> three, two;
  int low = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (a[i] == 1) {
      one.push_back({i, low});
      ans.push_back(one.back());
      low++;
    } else if (a[i] == 2) {
      if (one.size() == 0) {
        cout << -1 << endl;
        return;
      }
      ans.push_back({i, one.back().second});
      one.pop_back();
      two.push_back(i);
    } else if (a[i] == 3) {
      if (three.size()) {
        ans.push_back({three.back(), low});
        three.pop_back();
      } else if (two.size()) {
        ans.push_back({two.back(), low});
        two.pop_back();
      } else if (one.size()) {
        ans.push_back({one.back().first, low});
        one.pop_back();
      } else {
        cout << -1 << endl;
        return;
      }
      ans.push_back({i, low});
      low++;
      three.push_back(i);
    }
  }
  cout << ans.size() << endl;
  for (auto i : ans) {
    cout << n - i.second << " " << i.first + 1 << endl;
  }
  return;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
