#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000006;
int v[MAXN];
int acc[MAXN];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  while (cin >> n) {
    for (int i = 0; i < n; ++i) cin >> v[i];
    int soma = 0;
    sort(v, v + n);
    acc[0] = 0;
    for (int i = 0; i < n; ++i) {
      soma += v[i];
      acc[i + 1] = soma;
    }
    int res = MAXN;
    for (long long f = 0; 4 * f <= soma; f++) {
      if ((soma - 4 * f) % 3) continue;
      int t = (soma - 4 * f) / 3;
      if (f + t > n) continue;
      int x = abs(lower_bound(v + n - f - t, v + n - f, 4) - (v + n - f));
      res = min(res, x + acc[n - f - t]);
    }
    if (res == MAXN) res = -1;
    cout << res << endl;
  }
}
