#include <bits/stdc++.h>
using namespace std;
int N;
int A[1000000];
int main() {
  scanf("%d", &N);
  int sum = 0;
  for (int(i) = 0; (i) < (N); (i)++) scanf("%d", &A[i]), sum += A[i];
  sort(A, A + N, greater<int>());
  int lp = sum;
  int zan = 0;
  int ans = (1 << 29);
  for (int(i) = 0; (i) < (N + 1); (i)++) {
    if (3 * i <= sum && sum <= 4 * i) ans = min(ans, max(lp, zan));
    if (i == N) break;
    lp -= A[i];
    if (A[i] < 3) zan += 3 - A[i];
  }
  if (ans == (1 << 29)) ans = -1;
  printf("%d\n", ans);
}
