#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  int s = 0;
  vector<int> cnt(5, 0);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]), s += a[i], cnt[a[i]]++;
  if (s <= 2 || s == 5) {
    puts("-1");
    return 0;
  }
  if (!cnt[2] && !cnt[3]) {
    if (cnt[1] == 1)
      printf("2\n");
    else
      printf("%d\n", 2 * (cnt[1] / 3) + cnt[1] % 3);
    return 0;
  }
  int ans = 0;
  int t = min(cnt[1], cnt[2]);
  ans += t;
  cnt[1] -= t;
  cnt[2] -= t;
  ans += 2 * (cnt[1] / 3);
  cnt[1] %= 3;
  ans += cnt[1];
  ans += 2 * (cnt[2] / 3);
  cnt[2] %= 3;
  if (cnt[2] == 2) ans += 2;
  if (cnt[2] == 1) {
    if (cnt[4])
      ans += 1;
    else
      ans += 2;
  }
  printf("%d\n", ans);
  return 0;
}
