#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  while (1 == scanf("%d", &N)) {
    vector<int> A(N);
    for (int i = 0; i < (int)(N); i++) scanf("%d", &A[i]);
    sort((A).begin(), (A).end());
    int need_to_fill = 0, need_to_move = 0;
    for (int i = 0; i < (int)(N); i++) need_to_fill += max(0, 3 - A[i]);
    int total = accumulate((A).begin(), (A).end(), 0);
    sort((A).begin(), (A).end());
    int ans = INT_MAX;
    for (int i = 0; i < (int)(N); i++) {
      int num_rooms = N - i;
      if (4 * num_rooms >= total && 3 * num_rooms <= total) {
        int tmp = max(need_to_move, need_to_fill);
        ans = min(ans, tmp);
      }
      need_to_fill -= max(0, 3 - A[i]);
      need_to_move += A[i];
    }
    if (ans == INT_MAX)
      puts("-1");
    else
      printf("%d\n", ans);
  }
}
