#include <bits/stdc++.h>
int a[1000002];
int onesum(int one, int four, int three, int &sum) {
  if (one < 3 && one != 0) {
    if (three != 0) {
      sum += one;
      one = 0;
    } else {
      sum += 2;
      one = 0;
    }
  }
}
int Msum(int one, int four, int three, int &sum) {
  if (one >= 3) {
    sum += one / 3 * 2;
    three += one / 3;
    one = one % 3;
  }
  onesum(one, four, three, sum);
}
int twosum(int two, int four, int &sum) {
  if (two <= 3) {
    if (two == 1 && four != 0)
      sum++;
    else if (two == 1 && four == 0)
      sum += 2;
    if (two == 2 || two == 3) sum += 2;
  }
  return 0;
}
int main() {
  int n, i, one = 0, two = 0, three = 0, four = 0, zero = 0, sum = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (a[i] == 1) one++;
    if (a[i] == 2) two++;
    if (a[i] == 3) three++;
    if (a[i] == 4) four++;
  }
  if (one == 0 && two == 0) {
    printf("0");
    return 0;
  }
  if (one * 1 + two * 2 + three * 3 + four * 4 <= 2 ||
      one * 1 + two * 2 + three * 3 + four * 4 == 5) {
    printf("-1");
    return 0;
  }
  if (two >= one) {
    three += one;
    two -= one;
    sum += one;
    one = 0;
    twosum(two, four, sum);
    if (two > 3) {
      sum += two / 3 * 2;
      three += two / 3 * 2;
      two = two % 3;
      twosum(two, four, sum);
    }
  } else {
    sum += two;
    one -= two;
    three += two;
    Msum(one, four, three, sum);
  }
  printf("%d", sum);
  return 0;
}
