#include <bits/stdc++.h>
int a[5];
int main() {
  int n, i;
  int x;
  scanf("%d", &n);
  for (i = 0; i <= 4; i++) a[i] = 0;
  for (i = 1; i <= n; i++) {
    scanf("%d", &x);
    a[x]++;
  }
  x = 0;
  for (i = 1; i <= 4; i++) x = x + a[i] * i;
  if (x == 1 || x == 2 || x == 5)
    printf("-1\n");
  else {
    int res = 0;
    if (a[1] < a[2])
      res = a[1];
    else
      res = a[2];
    a[1] = a[1] - res;
    a[2] = a[2] - res;
    a[3] = a[3] + res;
    if (a[1] > 0) {
      x = a[1] / 3;
      res = res + x * 2;
      a[3] = a[3] + x;
      a[1] = a[1] % 3;
      if (a[3] >= a[1]) {
        res = res + a[1];
        a[4] = a[4] + a[1];
        a[3] = a[3] - a[1];
        a[1] = 0;
      }
      if (a[1] == 1) {
        res = res + 2;
        a[4] = a[4] - 2;
        a[3] = a[3] + 3;
        a[1] = 0;
      }
      if (a[1] == 2) {
        res = res + 2;
        a[4]--;
        a[3] = a[3] + 2;
      }
    }
    if (a[2] > 0) {
      x = a[2] / 3;
      res = res + 2 * x;
      a[3] = a[3] + 2 * x;
      a[2] = a[2] % 3;
      if (a[2] == 2) {
        res = res + 2;
        a[4]++;
        a[2] = 0;
      }
      if (a[2] == 1) {
        if (a[4] >= 1) {
          res++;
          a[4]--;
          a[3] = a[3] + 2;
          a[2] = 0;
        } else {
          res = res + 2;
          a[3] = a[3] - 2;
          a[4] = a[4] + 2;
          a[2] = 0;
        }
      }
    }
    printf("%d\n", res);
  }
  return 0;
}
