#include <bits/stdc++.h>
using namespace std;
int p0, p3, p4;
int n, sum, ans;
int a[10], p[10], A[10];
void calc() {
  int ret = 0;
  for (int i = 0; i < 5; i++) A[i] = a[i];
  for (int i = 0; i < 5; i++) {
    for (int j = 0; j < 5; j++) {
      int x = min(A[j], p[i]);
      ret += abs(j - i) * x;
      A[j] -= x;
      p[i] -= x;
    }
  }
  if (ans == -1)
    ans = ret;
  else
    ans = min(ans, ret);
}
int main() {
  scanf("%d", &n);
  memset(a, 0, sizeof(a));
  sum = 0;
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    a[x]++;
    sum += x;
  }
  ans = -1;
  for (p3 = 0; p3 <= n; p3++) {
    p4 = sum - 3 * p3;
    if (p4 < 0) continue;
    if (p4 % 4) continue;
    p4 /= 4;
    p0 = n - p3 - p4;
    if (p0 < 0) continue;
    p[0] = p0;
    p[1] = 0;
    p[2] = 0;
    p[3] = p3;
    p[4] = p4;
    calc();
  }
  if (ans > -1) ans /= 2;
  printf("%d\n", ans);
  return 0;
}
