#include <bits/stdc++.h>
using namespace std;
const long long C = 1e5;
const long long mxn = 501;
void solve() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long& x : a) cin >> x;
  long long one, two, three;
  one = two = three = 0;
  for (long long& x : a) {
    if (x == 1)
      ++one;
    else if (x == 2)
      two++;
    else
      three++;
  }
  long long f = 0;
  long long row = -n + 1;
  vector<long long> ans;
  set<long long> co;
  vector<long long> vis(n);
  for (long long i = n - 1; i > -1; i--) {
    if (a[i] == 1) {
      co.insert(i);
      continue;
    }
    if (a[i] == 2) {
      if (co.empty()) {
        cout << -1;
        return;
      }
      long long c = (*co.begin());
      co.erase(co.begin());
      ans.push_back(row);
      ans.push_back(i);
      ans.push_back(row);
      ans.push_back(c);
      vis[c] = 1;
      ++row;
    }
  }
  co.erase(co.begin(), co.end());
  for (long long i = n - 1; i > -1; i--) {
    if (a[i] == 3) {
      if (co.empty()) {
        cout << -1;
        return;
      }
      ans.push_back(row);
      ans.push_back(i);
      ans.push_back(row);
      ans.push_back(*co.begin());
      co.erase(co.begin());
      ++row;
    } else if (a[i] == 1 && vis[i] == 0) {
      ans.push_back(row);
      ans.push_back(i);
      ++row;
    }
    if (a[i] == 2 || (a[i] == 1 && vis[i] == 0) || a[i] == 3) {
      co.insert(i);
    }
  }
  cout << ans.size() / 2;
  for (long long i = 0; i < ans.size(); i += 2)
    cout << '\n' << ans[i] * -1 + 1 << " " << ans[i + 1] + 1;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  long long t = 1;
  while (t--) {
    solve();
    cout << '\n';
  }
}
