#include <bits/stdc++.h>
using namespace std;
using gg = long long;
gg ti, ni, mi, ki;
constexpr gg MAX = 1e5 + 5;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> ni;
  vector<gg> v(ni + 1);
  for (gg i = 1; i <= ni; ++i) {
    cin >> v[i];
  }
  vector<list<array<gg, 2>>> use(4);
  gg r = ni;
  vector<array<gg, 2>> ans;
  for (gg i = ni; i >= 1; --i) {
    if (v[i] == 1) {
      ans.push_back({r, i});
      use[1].push_back({r, i});
      --r;
    } else if (v[i] == 2) {
      if (use[1].empty()) {
        cout << "-1\n";
        return 0;
      }
      auto [k1, k2] = use[1].front();
      ans.push_back({k1, i});
      use[1].pop_front();
      use[2].push_back({k1, i});
    } else if (v[i] == 3) {
      if (use[1].empty() and use[2].empty() and use[3].empty()) {
        cout << "-1\n";
        return 0;
      }
      auto& t = not use[3].empty()   ? use[3]
                : not use[2].empty() ? use[2]
                                     : use[1];
      auto [k1, k2] = t.front();
      ans.push_back({r, i});
      ans.push_back({r, k2});
      t.pop_front();
      use[3].push_back({r, i});
      r--;
    }
  }
  cout << ans.size() << "\n";
  for (auto [i, j] : ans) {
    cout << i << " " << j << "\n";
  }
  return 0;
}
