#include <bits/stdc++.h>
using namespace std;
namespace IO {
inline long long read() {
  long long o = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    o = o * 10 + c - '0';
    c = getchar();
  }
  return o * f;
}
}  // namespace IO
using namespace IO;
const int N = 2e5 + 7, M = 1e6 + 7, INF = 0x3f3f3f3f, Mod = 1e9 + 7;
int a[N];
stack<pair<int, int> > c1, c2, c3, res;
int ans;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int row = n;
  for (int i = n; i > 0; i--) {
    if (a[i] == 0) continue;
    if (a[i] == 1) {
      c1.push({row, i}), res.push({row, i});
      row--;
      ans++;
    }
    if (a[i] == 2) {
      if (c1.empty()) {
        cout << -1 << endl;
        return 0;
      }
      pair<int, int> t = c1.top();
      c1.pop();
      c2.push({t.first, i}), res.push({t.first, i});
      ans++;
    }
    if (a[i] == 3) {
      if (c1.empty() && c2.empty() && c3.empty()) {
        cout << -1 << endl;
        return 0;
      }
      if (!c3.empty()) {
        pair<int, int> t = c3.top();
        c3.pop();
        c3.push({row, i});
        res.push({row, i}), res.push({row, t.second});
        row--, ans += 2;
        continue;
      }
      if (!c2.empty()) {
        pair<int, int> t = c2.top();
        c2.pop();
        c3.push({row, i});
        res.push({row, i}), res.push({row, t.second});
        row--, ans += 2;
        continue;
      }
      pair<int, int> t = c1.top();
      c1.pop();
      c3.push({row, i});
      res.push({row, i}), res.push({row, t.second});
      row--, ans += 2;
      continue;
    }
  }
  cout << ans << endl;
  while (!res.empty()) {
    cout << res.top().first << " " << res.top().second << endl;
    res.pop();
  }
  return 0;
}
