#include <bits/stdc++.h>
int n, s[1000005];
int cnt[10], tot = 0;
int main() {
  memset(cnt, 0, sizeof cnt);
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &s[i]);
    cnt[s[i]]++;
    tot += s[i];
  }
  if (tot == 1 || tot == 2 || tot == 5) {
    printf("-1\n");
    return 0;
  }
  if (cnt[1] == 1 && cnt[2] == 0 && cnt[3] == 0) {
    printf("2\n");
    return 0;
  }
  int ans = 0;
  if (cnt[1] >= cnt[2]) {
    ans += cnt[2];
    cnt[1] -= cnt[2];
    cnt[2] = 0;
    ans += (cnt[1] - cnt[1] / 3);
  } else {
    ans += cnt[1];
    cnt[2] -= cnt[1];
    cnt[1] = 0;
    ans += (cnt[2] / 3) * 2;
    cnt[2] %= 3;
    if (cnt[2] == 1) {
      if (cnt[4])
        ans++;
      else
        ans += 2;
    }
    if (cnt[2] == 2) {
      ans += 2;
    }
  }
  printf("%d\n", ans);
  return 0;
}
