#include <bits/stdc++.h>
using namespace std;
int cnt[5];
int n, res, sum;
int main() {
  ios_base::sync_with_stdio(false);
  scanf("%d", &n);
  int x;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &x);
    ++cnt[x];
    sum += x;
  }
  if (sum == 1 || sum == 2 || sum == 5) {
    puts("-1");
    return 0;
  }
  int mincnt = min(cnt[1], cnt[2]);
  res += mincnt;
  cnt[1] -= mincnt;
  cnt[2] -= mincnt;
  cnt[3] += mincnt;
  if (cnt[1]) {
    res += 2 * (cnt[1] / 3);
    cnt[3] += cnt[1] / 3;
    cnt[1] %= 3;
    if (cnt[1] == 1 && cnt[3] == 0)
      res += 2;
    else
      res += cnt[1];
  } else {
    res += 2 * (cnt[2] / 3);
    cnt[3] += 2 * (cnt[2] / 3);
    cnt[2] %= 3;
    if (cnt[2] == 1 && cnt[4] > 0)
      res++;
    else if (cnt[2] > 0)
      res += 2;
  }
  cout << res;
  return 0;
}
