#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void checkMin(T& a, T b) {
  if (b < a) a = b;
}
template <class T>
inline void checkMax(T& a, T b) {
  if (b > a) a = b;
}
inline int& RD(int& x) {
  scanf("%d", &x);
  return x;
}
inline int& RD(int& x, int& y) {
  scanf("%d%d", &x, &y);
  return x;
}
inline int& RD(int& x, int& y, int& z) {
  scanf("%d%d%d", &x, &y, &z);
  return x;
}
inline void WT(int x) { printf("%d\n", x); }
inline void WT(int x, int y) { printf("%d %d\n", x, y); }
inline void WT(int x, int y, int z) { printf("%d %d %d\n", x, y, z); }
inline long long& RD(long long& x) {
  scanf("%I64d", &x);
  return x;
}
inline long long& RD(long long& x, long long& y) {
  scanf("%I64d%I64d", &x, &y);
  return x;
}
inline long long& RD(long long& x, long long& y, long long& z) {
  scanf("%I64d%I64d%I64d", &x, &y, &z);
  return x;
}
inline void WT(long long x) { printf("%I64d\n", x); }
inline void WT(long long x, long long y) { printf("%I64d %I64d\n", x, y); }
inline void WT(long long x, long long y, long long z) {
  printf("%I64d %I64d %I64d\n", x, y, z);
}
inline double& RD(double& x) {
  scanf("%lf", &x);
  return x;
}
inline double& RD(double& x, double& y) {
  scanf("%lf%lf", &x, &y);
  return x;
}
inline double& RD(double& x, double& y, double& z) {
  scanf("%lf%lf%lf", &x, &y, &z);
  return x;
}
inline void WT(double x) { printf("%.4f\n", x); }
inline void WT(double x, double y) { printf("%.6f %.6f\n", x, y); }
inline void WT(double x, double y, double z) {
  printf("%.6f %.6f %.6f\n", x, y, z);
}
const int N = 1000005;
const int INF = 0x3f3f3f3f;
const long long LINF = 1ll << 62;
const double DINF = 1e20;
const double eps = 1e-12;
const int MOD = 1000000007;
const int dx[] = {-1, 0, 0, 1};
const int dy[] = {0, -1, 1, 0};
int n, sum, s[5];
int main() {
  cin >> n;
  memset(s, 0, sizeof(s));
  sum = 0;
  for (int i = 0; i < (int)(n); i++) {
    int x;
    RD(x);
    s[x]++;
    sum += x;
  }
  if (sum < 3 || sum == 5) {
    cout << -1 << endl;
    return 0;
  }
  if (s[2] == 0 && s[1] == 0) {
    cout << 0 << endl;
    return 0;
  }
  int ans = INF;
  for (int x = 0; x <= s[2]; x++) {
    if (s[1] + (s[2] - x) * 2 + s[4] < x) continue;
    if (s[1] + (s[2] - x) * 2 > x * 2 + s[3]) continue;
    checkMin(ans, max(s[1] + (s[2] - x) * 2, x));
  }
  int k1 = 0;
  while (s[1] - k1 > k1 * 3 + s[2] * 2 + s[3]) k1++;
  while (k1 <= s[1] && s[1] - k1 + s[4] >= k1 * 2 + s[2]) {
    checkMin(ans, max(s[1] - k1, k1 * 2 + s[2]));
    k1++;
  }
  cout << ans << endl;
  return 0;
}
