#include <bits/stdc++.h>
using namespace std;
int64_t an, n, k, m, r[100005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  vector<int> ans;
  stack<int> ones, twos, threes;
  an = 1;
  for (int i = 0; i < n; i++) cin >> r[i];
  for (int i = n - 1; i >= 0; i--) {
    if (r[i] == 1) {
      ans.push_back(i + 1);
      ans.push_back(i + 1);
      ones.push(i + 1);
    } else if (r[i] == 2) {
      if (ones.empty()) {
        an = 0;
        break;
      }
      k = ones.top();
      ones.pop();
      ans.push_back(k);
      ans.push_back(i + 1);
      twos.push(i + 1);
    } else if (r[i] == 3) {
      k = -1;
      if (!twos.empty()) {
        k = twos.top();
        twos.pop();
      }
      if (k == -1 && !threes.empty()) {
        k = threes.top();
        threes.pop();
      }
      if (k == -1 && !ones.empty()) {
        k = ones.top();
        ones.pop();
      }
      if (k == -1) {
        an = 0;
        break;
      }
      ans.push_back(i + 1);
      ans.push_back(k);
      ans.push_back(i + 1);
      ans.push_back(i + 1);
      threes.push(i + 1);
    }
  }
  if (!an) {
    cout << "-1\n";
    return 0;
  }
  k = ans.size();
  cout << k / 2 << "\n";
  for (int i = 0; i < k; i += 2) cout << ans[i] << " " << ans[i + 1] << "\n";
  return 0;
}
