#include <bits/stdc++.h>
using namespace std;
signed main() {
  int n;
  cin >> n;
  int cnt1 = 0;
  int cnt2 = 0;
  int cnt3 = 0;
  int cnt4 = 0;
  int sum = 0;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (a == 1) cnt1++;
    if (a == 2) cnt2++;
    if (a == 3) cnt3++;
    if (a == 4) cnt4++;
    sum += a;
  }
  int ans = 0;
  if (sum < 3 || sum == 5) {
    cout << -1;
    return 0;
  }
  while (cnt1 && cnt2) {
    ans++;
    cnt3++;
    cnt1--;
    cnt2--;
  }
  if (cnt1) {
    ans += (cnt1 - cnt1 / 3);
    if (cnt1 == 1 && !cnt3) {
      ans++;
    }
    cout << ans;
    return 0;
  }
  if (cnt2) {
    ans += (cnt2 - cnt2 / 3);
    int rem = cnt2 % 3;
    if (rem == 1 && cnt4 == 0) ans++;
    cout << ans;
    return 0;
  }
  cout << ans;
}
