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