#include <bits/stdc++.h>
using namespace std;
int n, cnt[5], sum[1100000];
int cal(int x, int y) {
  if (y < 0 || y > n) return n * 5;
  if (x < 0 || x > n) return n * 5;
  if (y < cnt[4]) return sum[n] - sum[x + y] + cnt[4] - y;
  return sum[n] - sum[x + y];
}
int main() {
  scanf("%d", &n);
  for (int i = 0, j; i < n; ++i) {
    scanf("%d", &j);
    cnt[j]++;
  }
  for (int i = 1; i <= cnt[4]; ++i) sum[i] = 4;
  for (int i = 1, j = cnt[4] + 1; i <= cnt[3]; ++i, ++j) sum[j] = 3;
  for (int i = 1, j = cnt[4] + cnt[3] + 1; i <= cnt[2]; ++i, ++j) sum[j] = 2;
  for (int i = 1, j = cnt[4] + cnt[3] + cnt[2] + 1; i <= cnt[1]; ++i, ++j)
    sum[j] = 1;
  for (int i = 1; i <= n; ++i) sum[i] += sum[i - 1];
  int a = cnt[4] * 4 + cnt[3] * 3 + cnt[2] * 2 + cnt[1], res = n * 5;
  for (int b = 1; b <= n; ++b) res = min(cal(4 * b - a, a - 3 * b), res);
  if (res > n * 4)
    puts("-1");
  else
    cout << res << endl;
  return 0;
}
