#include <bits/stdc++.h>
using namespace std;
void nosolve() { printf("-1\n"); }
int main() {
  int t, n, a[5];
  cin >> n;
  for (int i = 1; i <= 4; i++) a[i] = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &t);
    a[t]++;
  }
  int ans = 0;
  if (a[1] > a[2]) {
    ans += a[2];
    a[1] -= a[2];
    a[3] += a[2];
    ans += a[1] / 3 * 2;
    a[3] += a[1] / 3;
    a[1] = a[1] % 3;
    if (a[1] == 1) {
      if (a[3] >= 1)
        ans++;
      else if (a[4] >= 2)
        ans += 2;
      else {
        nosolve();
        return 0;
      }
    } else if (a[1] == 2) {
      if (a[4] >= 1)
        ans += 2;
      else if (a[3] >= 2)
        ans += 2;
      else {
        nosolve();
        return 0;
      }
    }
  } else if (a[1] < a[2]) {
    ans += a[1];
    a[2] -= a[1];
    a[3] += a[1];
    ans += a[2] / 3 * 2;
    a[3] += a[2] / 3 * 2;
    a[2] = a[2] % 3;
    if (a[2] == 1) {
      if (a[4] >= 1)
        ans++;
      else if (a[3] >= 2)
        ans += 2;
      else {
        nosolve();
        return 0;
      }
    } else if (a[2] == 2)
      ans += 2;
  } else if (a[1] == a[2])
    ans += a[1];
  printf("%d\n", ans);
  return 0;
}
