#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b[5];
  memset(b, 0, sizeof(b));
  scanf("%d", &n);
  int sum = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a);
    sum += a;
    b[a]++;
  }
  if (sum == 1 || sum == 2 || sum == 5) {
    printf("-1\n");
    return 0;
  }
  if (b[1] == 0 && b[2] == 0 && (b[3] != 0 || b[4] != 0)) {
    printf("0\n");
    return 0;
  }
  int cnt = 0;
  if (b[1] != 0 && b[2] != 0) {
    cnt += min(b[1], b[2]);
    b[1] -= cnt, b[2] -= cnt;
    b[3] += cnt;
  }
  if (b[1] == 0 && b[2] != 0) {
    cnt += 2 * (b[2] / 3);
    b[3] += 2 * (b[2] / 3);
    b[2] = b[2] % 3;
    if (b[2] == 1 && b[4] != 0)
      cnt++;
    else if (b[2] != 0)
      cnt += 2;
  }
  if (b[1] != 0 && b[2] == 0) {
    cnt += 2 * (b[1] / 3);
    b[3] += (b[1] / 3);
    b[1] = b[1] % 3;
    if (b[1] != 0) {
      if (b[3] != 0 && b[1] == 1)
        cnt++;
      else
        cnt += 2;
    }
  }
  printf("%d\n", cnt);
  return 0;
}
