#include <bits/stdc++.h>
using namespace std;
long int n;
long int arr[1000001];
int main() {
  long int i, j, a, b, c, one = 0, two = 0, three = 0, four = 0, ans = 0;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a;
    if (a == 1) {
      one++;
    } else if (a == 2) {
      two++;
    } else if (a == 3) {
      three++;
    } else if (a == 4) {
      four++;
    }
  }
  if (one >= two) {
    one = one - two;
    three = three + two;
    ans = ans + two;
    a = one / 3;
    three = three + a;
    ans = ans + a * 2;
    one = one - a * 3;
    if (one != 0) {
      if (three >= one) {
        ans = ans + one;
      } else if (one == 1 && four >= 2) {
        ans = ans + 2;
      } else if (one == 2 && four >= 1) {
        ans = ans + 2;
      } else {
        ans = -1;
      }
    }
  } else if (two > one) {
    two = two - one;
    ans = ans + one;
    three = three + one;
    a = two / 3;
    three = three + a * 2;
    ans = ans + a * 2;
    two = two - a * 3;
    if (two != 0) {
      if (four >= two) {
        ans = ans + two;
      } else if (two == 1 && three >= 2) {
        ans = ans + 2;
      } else if (two == 2) {
        ans = ans + 2;
      } else {
        ans = -1;
      }
    }
  }
  cout << ans;
  return 0;
}
