#include <bits/stdc++.h>
using namespace std;
int n, a[1000001];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + n + 1);
  int sum = 0, Left = 0, Right = 0;
  for (int i = 1; i <= n; i++) sum += a[i];
  for (int i = 1; i <= n; i++)
    if (a[i] <= 2) Right += 3 - a[i];
  int ans = 1 << 30;
  for (int i = 0; i <= n; i++) {
    if (i) {
      Left += a[i];
      if (a[i] <= 2) Right -= 3 - a[i];
    }
    if (3 * (n - i) <= sum && sum <= 4 * (n - i)) {
      ans = min(ans, max(Left, Right));
    }
  }
  if (ans == 1 << 30)
    printf("-1\n");
  else
    printf("%d\n", ans);
}
