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