#include <bits/stdc++.h>
using namespace std;
int cnt[5];
int ans = 0;
void solve(int a, int b, int c, int d) {
  int diff;
  while (!(a == 0 && b == 0)) {
    if (a != 0 && b != 0) {
      diff = min(a, b);
      ans += diff;
      a -= diff;
      b -= diff;
      c += diff;
      continue;
    }
    if (b == 0) {
      ans += 2 * (a / 3);
      c += (a / 3);
      a = a % 3;
      if (a == 1) {
        if (c >= 1) {
          ans++;
          c -= 1;
          d += 1;
          a = 0;
        } else if (d >= 1) {
          ans++;
          d -= 1;
          c += 1;
          b += 1;
          a = 0;
        } else {
          ans = -1;
          break;
        }
      } else if (a == 2) {
        if (c >= 2) {
          ans += 2;
          c -= 2;
          d += 2;
          a = 0;
        } else {
          ans++;
          b += 1;
          a = 0;
        }
      }
      continue;
    } else {
      c += (2 * (b / 3));
      ans += (2 * (b / 3));
      b = b % 3;
      if (b == 1) {
        if (d >= 1) {
          ans++;
          d--;
          b--;
          c += 2;
        } else if (c >= 2) {
          ans += 2;
          b -= 1;
          c -= 2;
          d += 2;
        } else {
          ans = -1;
          break;
        }
      } else if (b == 2) {
        ans += 2;
        b -= 2;
        d += 1;
      }
      continue;
    }
  }
}
int main() {
  int N;
  int temp;
  cin >> N;
  while (N--) {
    cin >> temp;
    cnt[temp]++;
  }
  solve(cnt[1], cnt[2], cnt[3], cnt[4]);
  cout << ans << endl;
  return 0;
}
