#include <bits/stdc++.h>
using namespace std;
int x, pt, ans, cnt[20];
int n, res;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    cnt[x]++;
  }
  pt = min(cnt[1], cnt[2]);
  ans += pt;
  cnt[1] -= pt;
  cnt[3] += pt;
  cnt[2] -= pt;
  if (cnt[1] > 0) {
    pt = (cnt[1] / 3) * 2;
    ans += pt;
    cnt[3] += cnt[1] / 3;
    cnt[1] %= 3;
  }
  if (cnt[2]) {
    ans += (cnt[2] / 3) * 2;
    cnt[3] += (cnt[2] / 3) * 2;
    cnt[2] %= 3;
  }
  for (int i = 1; i <= 4; i++) res = res + i * cnt[i];
  if (res == 1 || res == 2 || res == 5) {
    cout << -1;
    return 0;
  }
  if (cnt[1] == 0 && cnt[2] == 0) {
    cout << ans;
    return 0;
  }
  if (cnt[1] == 0) {
    if (cnt[2] <= cnt[4])
      ans += cnt[2];
    else
      ans += 2;
  }
  if (cnt[1] <= cnt[3])
    ans += cnt[1];
  else
    ans += 2;
  cout << ans;
  return 0;
}
