#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
int n, a[1000005];
void solve() {
  a[n++] = 0;
  sort(a, a + n);
  int sum2 = 0;
  for (int i = n - 1; i >= 0 && a[i] == 4; i--) {
    sum2++;
  }
  int minNeed = 0;
  int maxNeed = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] > 0 && a[i] < 3) {
      minNeed += 3 - a[i];
    }
    if (a[i] > 0 && a[i] < 4) {
      maxNeed += 4 - a[i];
    }
  }
  int ans = 1000000000;
  int sum1 = 0;
  for (int i = 0; i < n && a[i] < 3; i++) {
    sum1 += a[i];
    if (a[i] > 0 && a[i] < 3) {
      minNeed -= 3 - a[i];
    }
    if (a[i] > 0 && a[i] < 4) {
      maxNeed -= 4 - a[i];
    }
    if (sum1 + sum2 >= minNeed && sum1 <= maxNeed) {
      ans = min(ans, max(minNeed, sum1));
    }
  }
  cout << (ans == 1000000000 ? -1 : ans) << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  while (cin >> n) {
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    solve();
  }
}
