#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  int n;
  cin >> n;
  int tot = n;
  vector<int> S[4], A(n + 1);
  for (int i = 1; i <= n; ++i) {
    cin >> A[i];
    S[A[i]].push_back(i);
  }
  int Max = -1;
  if (((int)(S[3]).size())) {
    for (int i = S[3].back(); i <= n; ++i)
      if (A[i] == 2) {
        Max = i;
        break;
      }
    if (Max == -1) {
      for (int i = S[3].back(); i <= n; ++i)
        if (A[i] == 1) {
          Max = i;
          break;
        }
      if (Max == -1) {
        cout << -1;
        return 0;
      }
    }
  }
  vector<pair<int, int>> ans;
  for (int i = ((int)(S[1]).size()) - 1; i >= 0; --i) {
    int idx1 = S[1][i], idx2;
    if (idx1 == Max) continue;
    if (((int)(S[2]).size()))
      idx2 = S[2].back(), S[2].pop_back();
    else
      idx2 = 0;
    if (idx2) {
      if (idx2 > idx1) {
        cout << -1;
        return 0;
      } else {
        ans.emplace_back(tot, idx1);
        ans.emplace_back(tot, idx2);
        --tot;
      }
    } else {
      ans.emplace_back(tot, idx1);
      --tot;
    }
  }
  if (((int)(S[2]).size())) {
    cout << -1;
    return 0;
  }
  if (Max != -1 && A[Max] == 1) {
    ans.emplace_back(tot, Max);
    --tot;
  }
  for (int i = ((int)(S[3]).size()) - 1; i >= 0; --i) {
    ans.emplace_back(tot, S[3][i]);
    ans.emplace_back(tot, Max);
    Max = S[3][i];
    --tot;
  }
  if (tot >= 0) {
    cout << ((int)(ans).size()) << '\n';
    for (auto [x, y] : ans) cout << x << " " << y << "\n";
  } else {
    cout << -1;
  }
  return 0;
}
