#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, one, two, thee, fou;
  while (scanf("%d", &n) != EOF) {
    int t, x;
    t = 0, one = 0, two = 0, thee = 0, fou = 0;
    while (n--) {
      scanf("%d", &x);
      if (x == 1)
        one++;
      else if (x == 2)
        two++;
      else if (x == 3)
        thee++;
      else if (x == 4)
        fou++;
    }
    x = min(one, two);
    t += x;
    one -= x;
    two -= x;
    t += one / 3 * 2;
    thee += x;
    thee += one / 3;
    one %= 3;
    if (one == 1) {
      if (thee > 0)
        t++;
      else if (fou >= 2)
        t += 2;
      else
        x = -1;
    }
    if (one == 2) {
      if (fou >= 1)
        t += 2;
      else if (thee >= 2)
        t += 2;
      else
        x = -1;
    }
    t += two / 3 * 2;
    thee += two * 2 / 3;
    two %= 3;
    t += two / 2 * 2;
    if (two == 1) {
      if (fou > 0)
        t++;
      else if (thee >= 2)
        t += 2;
      else
        x = -1;
    }
    if (x != -1)
      printf("%d\n", t);
    else
      printf("-1\n");
  }
  return 0;
}
