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