#include <bits/stdc++.h>
template <typename t>
t getnum() {
  t res = 0;
  char c;
  int sign = 1;
  while (1) {
    c = getchar();
    if (c == ' ' || c == '\n')
      continue;
    else
      break;
  }
  if (c == '+') {
  } else if (c == '-')
    sign = -1;
  else
    res = c - '0';
  while (1) {
    c = getchar();
    if (c >= '0' && c <= '9')
      res = res * 10 + c - '0';
    else
      break;
  }
  return res * sign;
}
using namespace std;
int main(int argc, char *argv[]) {
  int n = getnum<int>();
  int siji, loro, telu, papat;
  siji = 0;
  loro = 0;
  telu = 0;
  papat = 0;
  int ans = 0;
  while (n--) {
    int now = getnum<int>();
    if (now == 1) siji++;
    if (now == 2) loro++;
    if (now == 3) telu++;
    if (now == 4) papat++;
  }
  bool g = true;
  int temp = min(siji, loro);
  siji -= temp;
  loro -= temp;
  telu += temp;
  ans += temp;
  if (siji > 0) {
    temp = siji / 3;
    siji -= temp * 3;
    telu += temp;
    ans += (temp * 2);
    if (telu >= siji) {
      papat += siji;
      telu -= siji;
      ans += siji;
      siji = 0;
    }
    if (siji == 1) {
      if (papat >= 2)
        ans += 2;
      else
        g = false;
    }
    if (siji == 2) {
      if (papat >= 1)
        ans += 2;
      else
        g = false;
    }
  }
  if (loro > 0) {
    int temp = loro / 3;
    loro -= (temp * 3);
    telu += (temp * 2);
    ans += (temp * 2);
    if (papat >= loro)
      ans += loro;
    else {
      if (loro == 2) {
        ans += 2;
      }
      if (loro == 1) {
        if (telu >= 2)
          ans += 2;
        else
          g = false;
      }
    }
  }
  if (g == false)
    printf("-1\n");
  else
    printf("%d\n", ans);
  return 0;
}
