#include <bits/stdc++.h>
using namespace std;
int g[7];
int n, sum, tp;
int main() {
  scanf("%d", &n);
  sum = 0;
  int a, rlt = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a);
    sum += a, g[a]++;
  }
  if (sum <= 2 || sum == 5) {
    puts("-1");
    return 0;
  }
  tp = min(g[1], g[2]);
  rlt += tp, g[1] -= tp, g[2] -= tp, g[3] += tp;
  tp = g[2] / 3;
  rlt += 2 * tp, g[2] -= 3 * tp, g[3] += 2 * tp;
  tp = g[1] / 3;
  rlt += 2 * tp, g[1] -= 3 * tp, g[3] += tp;
  rlt += g[1];
  if (g[1] == 1 && g[3] == 0) rlt++;
  if (g[2]) rlt += 2;
  if (g[2] == 1 && g[4]) rlt--;
  cout << rlt << endl;
}
