#include <bits/stdc++.h>
using namespace std;
int a[5];
int main() {
  int sum = 0, n, i, j, x;
  scanf("%d", &n);
  for (i = 0; i < n; ++i) {
    scanf("%d", &x);
    sum += x;
    if (x != 0) a[x]++;
  }
  if (sum == 5 || sum < 3) {
    cout << -1 << endl;
    return 0;
  }
  int ret = 0;
  if (a[2] > a[1]) {
    ret += a[1];
    a[2] -= a[1];
    a[3] += a[1];
    a[1] = 0;
    ret += (a[2] / 3) * 2;
    a[3] += (a[2] / 3) * 2;
    a[2] %= 3;
    if (a[2] == 2) ret += 2;
    if (a[2] == 1) {
      if (a[4] > 0)
        ++ret;
      else if (a[3] > 1)
        ret += 2;
      else
        assert(0);
    }
  } else {
    ret = a[2];
    a[1] -= a[2];
    a[3] += a[2];
    ret += (a[1] / 3) * 2;
    a[3] += (a[1] / 3);
    a[1] %= 3;
    if (a[1] == 2)
      ret += 2;
    else if (a[1] == 1) {
      if (a[3] >= 1)
        ++ret;
      else if (a[4] >= 2)
        ret += 2;
    }
  }
  cout << ret << endl;
}
