#include <bits/stdc++.h>
const int V = 5;
int num[V];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0, v; i < n; i++) {
    scanf("%d", &v);
    if (v) num[v]++;
  }
  int ans = 0;
  if (num[1] > num[2]) {
    ans += num[2];
    num[1] -= num[2];
    num[3] += num[2];
    num[2] = 0;
    if (num[1] >= 3) {
      ans += num[1] / 3 * 2;
      num[3] += num[1] / 3;
      num[1] %= 3;
    }
    if (num[1] == 1) {
      if (num[3] > 0) {
        ans++;
        goto out;
      }
      if (num[4] < 2) {
        ans = -1;
        goto out;
      } else
        ans += 2;
    } else if (num[1] == 2) {
      if (num[4] >= 1 || num[3] >= 2) {
        ans += 2;
        goto out;
      } else
        ans = -1;
    }
  } else {
    ans += num[1];
    num[2] -= num[1];
    num[3] += num[1];
    num[1] = 0;
    if (num[2] >= 3) {
      ans += num[2] / 3 * 2;
      num[3] += num[2] / 3 * 2;
      num[2] %= 3;
    }
    if (num[2] == 1) {
      if (num[4] >= 1) {
        ans++;
        goto out;
      } else if (num[3] >= 2) {
        ans += 2;
        goto out;
      } else
        ans = -1;
    } else if (num[2] == 2)
      ans += 2;
  }
out:
  printf("%d\n", ans);
  return 0;
}
