#include <bits/stdc++.h>
using namespace std;
int n, cnt, a[2222222], sum[2222222], ans = 1e9;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i], cnt += (a[i] == 4 ? 1 : 0);
  sort(a + 1, a + n + 1, greater<int>());
  for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + a[i];
  for (int i = 0; 3 * i <= sum[n]; i++) {
    if ((sum[n] - 3 * i) % 4 != 0) continue;
    int j = (sum[n] - 3 * i) / 4;
    if (i + j > n) continue;
    ans = min(ans, sum[n] - sum[i + j] + max(0, cnt - j));
  }
  if (ans != 1e9)
    cout << ans;
  else
    cout << -1;
  return 0;
}
