#include <bits/stdc++.h>
using namespace std;
int val[5], n, sum[1000050];
int a[1000050];
bool cmp(int a, int b) { return a > b; }
int main() {
  int ans;
  while (~scanf("%d", &n)) {
    sum[0] = 0;
    ans = -1;
    memset(val, 0, sizeof(val));
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      val[a[i]]++;
    }
    sort(a + 1, a + 1 + n, cmp);
    for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + a[i];
    int idx = val[4];
    if (val[4] == n) {
      puts("0");
      continue;
    }
    for (int r = val[4] + 1; r <= n; r++) {
      int Max = 4 * r - sum[r], Min = 3 * r - sum[r];
      int shit = sum[n] - sum[r];
      int tmp = 3 * (r - val[4]) - (sum[r] - sum[val[4]]);
      if (shit >= Min && shit <= Max) {
        if (ans == -1 || ans > shit + max(tmp - shit, 0)) {
          ans = shit + max(tmp - shit, 0);
        }
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
