#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, x;
  cin >> n;
  queue<int> s3, s2, s1;
  vector<int> a;
  for (int q = 0; q < n; q++) {
    cin >> x;
    if (x == 3) {
      s3.push(q);
    } else if (x == 2) {
      s2.push(q);
    } else if (x == 1) {
      s1.push(q);
    }
    a.push_back(x);
  }
  s3.push(1e6);
  s2.push(1e6);
  s1.push(1e6);
  int auks = 1;
  vector<pair<int, int> > ans;
  vector<int> used(n, 0);
  bool flag = false;
  for (int q = 0; q < n; q++) {
    if (q == s3.front()) {
      s3.pop();
    } else if (q == s2.front()) {
      s2.pop();
    } else if (q == s1.front()) {
      s1.pop();
    }
    if (a[q] == 0) {
      continue;
    } else if (a[q] == 1 && used[q] == 0) {
      ans.push_back({q + 1, auks++});
    } else if (a[q] == 2) {
      if (s1.front() == 1e6) {
        flag = true;
        break;
      }
      if (used[q] == 0) {
        ans.push_back({q + 1, auks});
        used[q] = auks;
      }
      ans.push_back({s1.front() + 1, used[q]});
      used[s1.front()] = used[q];
      auks = max(auks, used[q] + 1);
      s1.pop();
    } else if (a[q] == 3) {
      if (s3.front() != 1e6 && s3.front() < s2.front() &&
          s3.front() < s1.front()) {
        if (used[q] == 0) {
          ans.push_back({q + 1, auks});
          used[q] = auks;
        }
        ans.push_back({s3.front() + 1, used[q]});
        ans.push_back({s3.front() + 1, used[q] + 1});
        auks = max(auks, used[q] + 2);
        used[s3.front()] = used[q] + 1;
        s3.pop();
      } else if (s2.front() != 1e6 && s2.front() < s3.front() &&
                 s2.front() < s1.front()) {
        if (used[q] == 0) {
          ans.push_back({q + 1, auks});
          used[q] = auks;
        }
        ans.push_back({s2.front() + 1, used[q]});
        ans.push_back({s2.front() + 1, used[q] + 1});
        auks = max(auks, used[q] + 2);
        used[s2.front()] = used[q] + 1;
        s2.pop();
      } else if (s1.front() != 1e6 && s1.front() < s3.front() &&
                 s1.front() < s2.front()) {
        if (used[q] == 0) {
          ans.push_back({q + 1, auks});
          used[q] = auks;
        }
        ans.push_back({s1.front() + 1, used[q]});
        ans.push_back({s1.front() + 1, used[q] + 1});
        auks = max(auks, used[q] + 2);
        used[s1.front()] = used[q] + 1;
        s1.pop();
      } else {
        flag = true;
        break;
      }
    }
  }
  if (flag) {
    cout << "-1\n";
  } else {
    cout << ans.size() << "\n";
    for (int q = 0; q < ans.size(); q++) {
      cout << ans[q].second << " " << ans[q].first << "\n";
    }
  }
  return 0;
}
