#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int a[5] = {0};
  int n, S = 0;
  cin >> n;
  for (int _n(n), i(0); i < _n; i++) {
    int t;
    cin >> t;
    a[t]++;
    S += t;
  }
  int ans = 1011111111;
  int cur[5], needed[5];
  for (int i = 0; 4 * i <= S; ++i) {
    int j = (S - 4 * i) / 3;
    if (i * 4 + j * 3 != S) continue;
    if (i + j > n) continue;
    memcpy(cur, a, sizeof a);
    memset((needed), (0), sizeof(needed));
    needed[4] = i;
    needed[3] = j;
    needed[0] = n - i - j;
    int ret = 0;
    for (int k = 4; k >= 0; --k)
      for (int l = 4; l >= 0; --l) {
        int mn = min(cur[k], needed[l]);
        ret += abs(k - l) * mn;
        cur[k] -= mn;
        needed[l] -= mn;
      }
    ans = min(ans, ret / 2);
  }
  cout << (ans == 1011111111 ? -1 : ans) << endl;
  return 0;
}
