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