#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
int n, ans, sum, a[N], c[5];
int main() {
  scanf("%d", &n);
  for (int i = 1, x; i <= n; i++) scanf("%d", &x), sum += x, c[x]++;
  if (sum == 1 || sum == 2 || sum == 5) {
    puts("-1");
    return 0;
  }
  if (c[1] == c[2]) {
    printf("%d", c[1]);
    return 0;
  }
  ans += min(c[1], c[2]);
  c[3] += min(c[1], c[2]);
  if (c[1] > c[2])
    c[1] -= c[2], c[2] = 0;
  else
    c[2] -= c[1], c[1] = 0;
  if (c[2]) {
    while (c[2] >= 3) c[2] -= 3, ans += 2, c[3] += 2;
    if (c[2] == 2)
      ans += 2;
    else if (c[2] == 1) {
      if (c[4])
        ans++;
      else if (c[3] >= 2)
        ans += 2;
      else
        ans = -1;
    }
    printf("%d", ans);
    return 0;
  }
  while (c[1] >= 3) c[1] -= 3, ans += 2, c[3]++;
  if (c[1] == 1) {
    if (c[3])
      ans++;
    else if (c[4] >= 2)
      ans += 2;
    else
      ans = -1;
  } else if (c[1] == 2) {
    if (c[4] || c[3] >= 2)
      ans += 2;
    else
      ans = -1;
  }
  printf("%d", ans);
}
