#include <bits/stdc++.h>
using namespace std;
const int N = 100010, M = 1010;
int n, a[N];
int two_match[N];
bool st[N];
vector<pair<int, int> > res;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  vector<int> three;
  for (int i = 1; i <= n; i++)
    if (a[i] == 3) three.emplace_back(i);
  int three_rst = 0;
  if ((int)three.size()) {
    for (int i = n; i > three.back(); i--)
      if (a[i] == 2) {
        three_rst = i;
        break;
      }
    if (!three_rst) {
      for (int i = n; i > three.back(); i--)
        if (a[i] == 1) {
          three_rst = i;
          break;
        }
    }
    if (!three_rst) {
      cout << "-1\n";
      return 0;
    }
  }
  vector<int> one;
  for (int i = n; i >= 1; i--)
    if (a[i] == 1 && i != three_rst)
      one.emplace_back(i);
    else if (a[i] == 2) {
      if (!(int)one.size()) {
        cout << "-1\n";
        return 0;
      } else {
        two_match[i] = one.back();
        one.pop_back();
      }
    }
  int row = 0;
  if ((int)three.size()) {
    for (int i = 0; i < (int)three.size(); i++) {
      if (i) res.emplace_back(make_pair(row, three[i]));
      row++;
      res.emplace_back(make_pair(row, three[i]));
      st[three[i]] = true;
    }
    res.emplace_back(make_pair(row, three_rst));
    row++;
    res.emplace_back(make_pair(row, three_rst));
    st[three_rst] = true;
    if (a[three_rst] == 2) {
      int col = two_match[three_rst];
      res.emplace_back(make_pair(row, col));
      st[col] = true;
    }
  }
  row++;
  for (int i = 1; i <= n; i++)
    if (!st[i]) {
      if (a[i] == 1) {
        res.emplace_back(make_pair(row, i));
        st[i] = true;
      } else if (a[i] == 2) {
        res.emplace_back(make_pair(row, i));
        res.emplace_back(make_pair(row, two_match[i]));
        st[i] = st[two_match[i]] = true;
      }
      row++;
    }
  cout << (int)res.size() << '\n';
  for (auto u : res) cout << u.first << ' ' << u.second << '\n';
  return 0;
}
