#include <bits/stdc++.h>
using namespace std;
int n, a[100005];
bool sel[100005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int poz1 = 0;
  int poz2 = 0;
  int l = 1;
  vector<pair<int, int>> rez;
  for (int i = 1; i <= n; i++) {
    if (a[i] == 2) {
      poz1 = max(poz1 + 1, i + 1);
      while (poz1 <= n && a[poz1] != 1) {
        ++poz1;
      }
      if (poz1 == n + 1) {
        cout << -1 << '\n';
        return 0;
      }
      rez.push_back({l, i});
      rez.push_back({(l++), poz1});
      sel[poz1] = true;
    } else if (a[i] == 3) {
      poz2 = max(poz2 + 1, i + 1);
      while (poz2 <= n && a[poz2] != 2 && a[poz2] != 3) {
        ++poz2;
      }
      if (poz2 <= n) {
        rez.push_back({l, i});
        rez.push_back({(l++), poz2});
      } else {
        poz1 = max(poz1 + 1, i + 1);
        while (poz1 <= n && a[poz1] != 1) {
          ++poz1;
        }
        if (poz1 == n + 1) {
          cout << -1 << '\n';
          return 0;
        }
        rez.push_back({l, i});
        rez.push_back({(l++), poz1});
      }
    }
    if (l <= 0) {
      cout << -1 << '\n';
      return 0;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (a[i] == 1 && !sel[i]) {
      rez.push_back({(l++), i});
    }
  }
  cout << rez.size() << '\n';
  for (auto it : rez) {
    cout << it.first << ' ' << it.second << '\n';
  }
  return 0;
}
