#include <bits/stdc++.h>
using namespace std;
int a[1000000 + 100];
int main() {
  int i, j, n;
  int tol, ans;
  int t1, t2, t4;
  cin >> n;
  t1 = t2 = t4 = 0;
  tol = 0;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    tol += a[i];
    if (a[i] == 1)
      t1++;
    else if (a[i] == 2)
      t2++;
    else if (a[i] == 4)
      t4++;
  }
  if (tol <= 2 || tol == 5) {
    cout << -1 << endl;
    return 0;
  }
  if (t4 == n - 1) {
    if (t1) printf("2\n");
    return 0;
  }
  if (t1 >= t2) {
    t1 -= t2;
    ans = t1 / 3 * 2;
    t1 -= t1 / 3 * 3;
    cout << t2 + ans + t1 << endl;
    return 0;
  } else {
    ans = t1;
    t2 -= t1;
    ans += t2 / 3 * 2;
    t2 -= t2 / 3 * 3;
    tol = 0;
    for (i = 1; i <= n; i++)
      if (a[i] >= 4) tol++;
    if (t2 == 1 && tol)
      ans += 1;
    else if (t2)
      ans += 2;
    cout << ans << endl;
  }
}
