#include <bits/stdc++.h>
using namespace std;
int n, ans, res, sum, v[7];
int main() {
  int a, qtd, y;
  scanf(" %d", &n);
  sum = 0;
  for (int i = 0; i < 5; i++) v[i] = 0;
  for (int i = 0; i < n; i++) {
    scanf(" %d", &a);
    sum += a;
    v[a]++;
  }
  res = (1 << 28);
  for (int x = 0; 3 * x <= sum; x++) {
    if ((sum - 3 * x) % 4 != 0) continue;
    y = (sum - 3 * x) / 4;
    ans = 0;
    if (v[4] > y) ans += v[4] - y;
    qtd = v[1] + v[2] + v[3] + v[4] - x - y;
    for (int i = 1; i < 5; i++) {
      ans += i * min(v[i], qtd);
      qtd -= min(v[i], qtd);
    }
    res = min(res, ans);
  }
  printf("%d\n", res == (1 << 28) ? -1 : res);
  return 0;
}
