#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int n, a[5], h;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &h);
    a[h]++;
  }
  int tot = a[4] * 4 + a[3] * 3 + a[2] * 2 + a[1] * 1;
  int ans = INF;
  for (int x = 0, y, now, z; x * 4 <= tot; x++) {
    y = tot - x * 4;
    if (y % 3) continue;
    now = 0;
    y /= 3;
    if (a[4] >= x) {
      now = 0;
      z = x + y - a[4] - a[3];
      now += max(2 * z - a[2], z);
    } else {
      now = x - a[4];
      if (x + y > a[4] + a[3]) {
        z = x + y - a[4] - a[3];
        now += max(2 * z - a[2], z);
      }
    }
    ans = min(now, ans);
  }
  if (ans == INF)
    puts("-1");
  else
    printf("%d\n", ans);
  return 0;
}
