#include <bits/stdc++.h>
using namespace std;
int s[5];
int sum = 0;
int n, x;
int main(int argc, char *argv[]) {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int k;
    scanf("%d", &k);
    s[k]++;
    sum += k;
  }
  int ans = 1000000000;
  for (int k = sum / 4; k <= sum / 3; k++) {
    if (3 * k <= sum && sum <= 4 * k) {
      int c4 = sum - k * 3;
      int c3 = k - c4;
      int res = 0;
      int w = s[1] + s[2] + s[3] + s[4] - k;
      if (w < 0) continue;
      if (s[4] > c4) {
        res += (s[4] - c4);
      }
      int t = min(s[1], w);
      res += t;
      res += 2 * (w - t);
      ans = min(ans, res);
    }
  }
  if (ans == 1000000000) ans = -1;
  printf("%d\n", ans);
  return 0;
}
