#include <bits/stdc++.h>
const int Maxn = 300020;
using namespace std;
int n, m, sum, a, x, y, ans, ct[10];
int main() {
  ios::sync_with_stdio();
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a, ct[a]++;
  if (ct[4] == 1 && ct[1] == 1 && ct[2] == 0 && ct[3] == 0) {
    cout << -1 << endl;
    return 0;
  }
  ans = min(ct[1], ct[2]);
  ct[1] -= ans;
  ct[2] -= ans;
  ct[3] += ans;
  if (ct[1]) {
    ans += ct[1] / 3 * 2;
    ct[3] += ct[1] / 3;
    ct[1] = ct[1] % 3;
    if (ct[1] <= ct[3])
      ans += ct[1];
    else {
      if (ct[1] == 1) {
        if (ct[4])
          ans += 2;
        else
          ans = -1;
      }
      if (ct[1] == 2) {
        if (ct[4])
          ans += 2;
        else
          ans = -1;
      }
    }
  } else if (ct[2]) {
    ans += ct[2] / 3 * 2;
    ct[3] += ct[2] / 3 * 2;
    ct[2] %= 3;
    if (ct[2] <= ct[4])
      ans += ct[2];
    else {
      if (ct[2] == 1) {
        if (ct[3] < 2)
          ans = -1;
        else
          ans += 2;
      } else {
        ans += 2;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
