#include <bits/stdc++.h>
using namespace std;
int a[5];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  while (cin >> n) {
    memset(a, 0, sizeof(a));
    for (int i = (1); i <= (n); i++) {
      int x;
      cin >> x;
      a[x]++;
    }
    int ans = 0;
    ans += min(a[1], a[2]);
    a[3] += min(a[1], a[2]);
    int tmp = a[2];
    a[2] = max(0, a[2] - a[1]);
    a[1] = max(0, a[1] - tmp);
    a[3] += a[1] / 3;
    ans += (int)(a[1] / 3) * 2;
    a[1] = a[1] % 3;
    a[3] += (int)(a[2] / 3) * 2;
    ans += (int)(a[2] / 3) * 2;
    a[2] = a[2] % 3;
    if (a[1] == 1) {
      if (a[3] > 0)
        ans++;
      else if (a[4] > 1)
        ans += 2;
      else
        ans = -1;
    } else if (a[1] == 2) {
      if (a[4] > 0 || a[3] > 1)
        ans += 2;
      else
        ans = -1;
    }
    if (a[2] == 1) {
      if (a[4] > 0)
        ans++;
      else if (a[3] >= 2)
        ans += 2;
      else
        ans = -1;
    } else if (a[2] == 2) {
      if (a[4] >= 1 || a[3] >= 1)
        ans += 2;
      else
        ans = -1;
    }
    cout << ans << endl;
  }
  return 0;
}
