#include <bits/stdc++.h>
using namespace std;
int cnt[5];
const int MAX = (int)1e9;
int main() {
  int sum = 0;
  int(n);
  scanf("%d", &n);
  for (int i = 0; i < (n); ++i) {
    int(x);
    scanf("%d", &x);
    cnt[x]++;
    sum += x;
  }
  int mi = MAX;
  cnt[0] += 1000000000;
  for (int i = 0; i * 3 <= sum; i++) {
    if ((sum - i * 3) % 4 == 0) {
      int j = (sum - i * 3) >> 2;
      if (cnt[4] >= j) {
        int need = 0;
        int r = i - (cnt[4] - j);
        for (int k = 3; k >= 0 && r; k--) {
          int tmp = min(r, cnt[k]);
          need += tmp * (3 - k);
          r -= tmp;
        }
        mi = min(mi, need);
      } else {
        int cc[5] = {}, need = 0;
        for (int k = 0; k <= 4; k++) cc[k] = cnt[k];
        int r = j;
        for (int k = 4; k >= 0 && r; k--) {
          int tmp = min(r, cc[k]);
          need += tmp * (4 - k);
          cc[k] -= tmp;
          r -= tmp;
        }
        r = i;
        for (int k = 3; k >= 0 && r; k--) {
          int tmp = min(r, cc[k]);
          need += tmp * (3 - k);
          cc[k] -= tmp;
          r -= tmp;
        }
        mi = min(mi, need);
      }
    }
  }
  if (mi == MAX)
    puts("-1");
  else {
    printf("%d\n", mi);
  }
  return 0;
}
