#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 30;
int f[5], t[5];
int main() {
  int n;
  scanf("%d", &n);
  int sum = 0;
  for (int i = 0; i < n; ++i) {
    int foo;
    scanf("%d", &foo);
    f[foo]++;
    sum += foo;
  }
  int ans = inf;
  for (int _4 = 0; _4 * 4 <= sum; ++_4) {
    int _3 = sum - _4 * 4;
    if (_3 % 3) continue;
    _3 /= 3;
    if (_3 + _4 > n) continue;
    int need_4 = _4, need_3 = _3, need_0 = n - _4 - _3;
    memcpy(t, f, sizeof t);
    int res = 0;
    for (int i = 4; i >= 0; --i) {
      if (need_4) {
        int v = need_4 < t[i] ? need_4 : t[i];
        need_4 -= v;
        t[i] -= v;
        res += (4 - i) * v;
        if (need_4 == 0) ++i;
      } else if (need_3) {
        int v = need_3 < t[i] ? need_3 : t[i];
        need_3 -= v;
        t[i] -= v;
        res += abs(3 - i) * v;
        if (need_3 == 0) ++i;
      } else if (need_0) {
        int v = need_0 < t[i] ? need_0 : t[i];
        need_0 -= v;
        t[i] -= v;
        res += i * v;
      }
    }
    res /= 2;
    if (ans > res) ans = res;
  }
  if (ans == inf) ans = -1;
  printf("%d\n", ans);
  return 0;
}
