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