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