#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 7;
const int inf = 1e9;
const long long inff = 1e18;
const long long mod = 1e9 + 7;
int a[maxn];
vector<int> v[maxn];
vector<int> tmp;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int _1 = 0, _2 = 0;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = n; i >= 1; i--) {
    if (a[i] == 1) {
      v[_1 + 1].push_back(i);
      _1++;
    } else if (a[i] == 2) {
      _2++;
      if (_2 > _1) return cout << -1 << endl, 0;
      v[_2].push_back(i);
    } else if (a[i] == 3) {
      if (_2 > 0) {
        v[1].push_back(i);
      } else {
        v[1].push_back(i);
        _2++;
        if (_2 > _1) return cout << -1 << endl, 0;
      }
    }
  }
  int cntt = 1;
  vector<pair<int, int> > ans;
  for (int i = 1; i <= n; i++) {
    reverse((v[i]).begin(), (v[i]).end());
    for (int j = 0; j < ((int)(v[i]).size()); j++) {
      if (a[v[i][j]] >= 2) {
        ans.push_back({cntt, v[i][j]});
        ans.push_back({cntt, v[i][j + 1]});
        cntt++;
      } else {
        if (((int)(v[i]).size()) == 1 || a[v[i][j - 1]] == 3) {
          ans.push_back({cntt, v[i][j]});
          cntt++;
        }
      }
    }
  }
  cout << ((int)(ans).size()) << endl;
  for (pair<int, int> i : ans) cout << i.first << ' ' << i.second << endl;
}
