#include <bits/stdc++.h>
using namespace std;
int a[1000009], cnt[10], b[1000009], n;
vector<int> G;
bool cmp(int x, int y) { return x > y; }
int bin(int L, int R) {
  while (L < R) {
    int M = (L + 1 + R) >> 1;
    if (G[M] == 4)
      L = M;
    else
      R = M - 1;
  }
  if (G[L] != 4)
    return -1;
  else
    return L + 1;
}
int main() {
  scanf("%d", &n);
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    sum += a[i];
    if (a[i]) cnt[a[i]]++;
    G.push_back(a[i]);
  }
  sort(G.begin(), G.end(), cmp);
  for (int i = 0; i < (int)G.size(); i++) b[i + 1] = b[i] + G[i];
  int ans = 1e9;
  for (int i = 0; i <= sum / 4; i++) {
    int j = sum - 4 * i;
    if (j % 3) continue;
    j /= 3;
    if (i + j > n) continue;
    int cur = 4 * i - b[i];
    int last_four = bin(i, n - 1);
    if (last_four == -1) {
      cur = cur + 3 * j - (b[i + j] - b[i]);
    } else {
      cur = cur + (b[last_four] - b[i]) - 3 * (last_four - i) +
            3 * (j - (last_four - i)) - (b[i + j] - b[last_four]);
    }
    cur = cur + b[n] - b[i + j];
    cur /= 2;
    ans = min(ans, cur);
  }
  if (ans == 1e9) ans = -1;
  printf("%d\n", ans);
  return 0;
}
