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