#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int a[maxn];
int R[maxn];
int C[maxn];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  queue<int> q2;
  queue<int> q3;
  vector<pair<int, int>> ans;
  int r = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == 0) {
      continue;
    } else if (a[i] == 1) {
      if (q2.size()) {
        int rr = q2.front();
        q2.pop();
        ans.push_back({rr, i});
        R[rr]++;
        C[i]++;
      } else if (q3.size()) {
        int rr = q3.front();
        q3.pop();
        ans.push_back({rr, i});
        ans.push_back({r, i});
        R[rr]++;
        R[r]++;
        C[i] += 2;
        r++;
      } else {
        ans.push_back({r, i});
        R[r]++;
        C[i]++;
        r++;
      }
    } else if (a[i] == 2) {
      q2.push(r);
      if (q3.size()) {
        int rr = q3.front();
        q3.pop();
        ans.push_back({rr, i});
        ans.push_back({r, i});
        R[rr]++;
        R[r]++;
        C[i] += 2;
        r++;
      } else {
        ans.push_back({r, i});
        R[r]++;
        C[i]++;
      }
      r++;
    } else {
      if (q3.size()) {
        int rr = q3.front();
        q3.pop();
        ans.push_back({rr, i});
        ans.push_back({r, i});
        R[rr]++;
        R[r]++;
        C[i] += 2;
      } else {
        ans.push_back({r, i});
        R[r]++;
        C[i]++;
      }
      q3.push(r);
      r++;
    }
  }
  bool flag = true;
  for (int i = 0; i < n; i++) {
    if ((R[i] > 2) || (C[i] > 2)) flag = false;
  }
  if ((r > n) || (q2.size()) || (q3.size()) || (!flag)) {
    cout << -1 << endl;
    return 0;
  }
  cout << (int)ans.size() << endl;
  for (auto i : ans) {
    cout << i.first + 1 << " " << i.second + 1 << endl;
  }
  return 0;
}
