#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
int n;
int a[5];
int main() {
  scanf("%d", &n);
  int sum = 0;
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    a[x]++;
    sum += x;
  }
  if (sum < 3 || sum == 5) {
    printf("-1\n");
    return 0;
  }
  int ans = 0;
  int temp;
  while (a[1]) {
    temp = min(a[1], a[2]);
    a[1] -= temp;
    a[2] -= temp;
    a[3] += temp;
    ans += temp;
    a[3] += a[1] / 3;
    ans += a[1] / 3 * 2;
    a[1] %= 3;
    if (a[1] > a[3]) {
      if (a[1] == 1) {
        a[4] -= 2;
        a[3] += 3;
        a[1] = 0;
        ans += 2;
      } else if (a[1] == 2) {
        a[4]--;
        a[1] = 0;
        a[3] += 2;
        ans += 2;
      }
    }
    temp = min(a[1], a[3]);
    a[1] -= temp;
    a[3] -= temp;
    a[4] += temp;
    ans += temp;
  }
  while (a[2]) {
    a[3] += a[2] / 3 * 2;
    ans += a[2] / 3 * 2;
    a[2] %= 3;
    if (a[2] == 2) {
      ans += 2;
      a[4]++;
      a[2] = 0;
    }
    temp = min(a[2], a[4]);
    a[2] -= temp;
    a[4] -= temp;
    a[3] += temp * 2;
    ans += temp;
    temp = min(a[2], a[3] / 2);
    a[2] -= temp;
    a[3] -= temp * 2;
    a[4] += temp * 2;
    ans += temp * 2;
  }
  printf("%d\n", ans);
  return 0;
}
