#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  std::cerr << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  std::cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const long long int N = 1e5 + 5;
void Hariiih() {
  long long int n;
  cin >> n;
  long long int arr[n];
  for (long long int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  vector<pair<long long int, long long int> > ans, ones, nonones;
  long long int row = n;
  for (long long int i = n - 1; i >= 0; i--) {
    if (arr[i] == 0)
      continue;
    else if (arr[i] == 1) {
      ans.push_back({row, i + 1});
      ones.push_back({row, i + 1});
      row--;
    } else if (arr[i] == 2) {
      if ((long long int)ones.size() == 0) {
        cout << -1 << '\n';
        return;
      }
      ans.push_back({ones.back().first, i + 1});
      nonones.push_back({ones.back().first, i + 1});
      ones.pop_back();
    } else {
      if ((long long int)ones.size() == 0 &&
          (long long int)nonones.size() == 0) {
        cout << -1 << '\n';
        return;
      }
      if ((long long int)nonones.size()) {
        ans.push_back({row, i + 1});
        ans.push_back({row, nonones.back().second});
        nonones.pop_back();
        nonones.push_back({row, i + 1});
        row--;
      } else {
        ans.push_back({row, i + 1});
        ans.push_back({row, ones.back().second});
        ones.pop_back();
        nonones.push_back({row, i + 1});
        row--;
      }
    }
  }
  cout << (long long int)ans.size() << '\n';
  for (long long int i = 0; i < (long long int)ans.size(); ++i) {
    cout << ans[i].first << " " << ans[i].second << '\n';
  }
  return;
}
signed main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  while (t--) Hariiih();
  return 0;
}
