#include <bits/stdc++.h>
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  size_t n;
  std::cin >> n;
  std::vector<std::pair<size_t, size_t>> answer;
  std::vector<size_t> stack_2, stack_3;
  for (size_t i = 0; i < n; ++i) {
    size_t a;
    std::cin >> a;
    if (a == 1) {
      size_t x = i;
      if (!stack_2.empty()) {
        size_t y = stack_2.back();
        stack_2.pop_back();
        answer.emplace_back(x, y);
        x = y;
      }
      while (!stack_3.empty()) {
        size_t y = stack_3.back();
        if (y > x) break;
        stack_3.pop_back();
        answer.emplace_back(x, x);
        answer.emplace_back(x, y);
        x = y;
      }
      answer.emplace_back(x, x);
    } else if (a == 2) {
      stack_2.push_back(i);
    } else if (a == 3) {
      stack_3.push_back(i);
    }
  }
  if (!stack_2.empty() || !stack_3.empty()) {
    std::cout << "-1\n";
    return 0;
  }
  std::cout << answer.size() << '\n';
  for (auto&& [x, y] : answer) std::cout << y + 1 << ' ' << x + 1 << '\n';
}
