#include <bits/stdc++.h>
using namespace std;
int n, m;
int ans, cnt[10], sum;
int check() {
  int s;
  if (cnt[1] < cnt[2]) {
    ans += cnt[1];
    cnt[0] += cnt[1];
    cnt[3] += cnt[1];
    cnt[2] -= cnt[1];
    cnt[1] = 0;
    s = cnt[2] / 3;
    ans += s * 2;
    cnt[3] += s * 2;
    cnt[0] += s;
    cnt[2] -= s * 3;
  } else {
    ans += cnt[2];
    cnt[0] += cnt[2];
    cnt[3] += cnt[2];
    cnt[1] -= cnt[2];
    cnt[2] = 0;
    s = cnt[1] / 3;
    ans += s * 2;
    cnt[0] += s * 2;
    cnt[3] += s;
    cnt[1] -= s * 3;
  }
  if (cnt[1] && cnt[4]) {
    s = min(cnt[1] / 2, cnt[4]);
    ans += 2 * s;
    cnt[3] += s * 2;
    cnt[4] -= s;
    cnt[1] -= 2 * s;
    cnt[0] += s;
  }
  if (cnt[1] && cnt[3]) {
    s = min(cnt[1], cnt[3]);
    ans += s;
    cnt[4] += s;
    cnt[3] -= s;
    cnt[1] -= s;
    cnt[0] += s;
  }
  if (cnt[1] && cnt[4]) {
    s = min(cnt[1], cnt[4] / 2);
    ans += 2 * s;
    cnt[3] += s * 3;
    cnt[4] -= s * 2;
    cnt[1] -= s;
  }
  if (cnt[2]) {
    s = cnt[2] / 2;
    ans += 2 * s;
    cnt[0] += s;
    cnt[2] -= 2 * s;
    cnt[4] += s;
  }
  if (cnt[2] && cnt[4]) {
    s = min(cnt[2], cnt[4]);
    ans += s;
    cnt[4] -= s;
    cnt[3] += 2 * s;
    cnt[2] -= s;
  }
  if (cnt[2] && cnt[3]) {
    s = min(cnt[2], cnt[3] / 2);
    ans += 2 * s;
    cnt[0] += s;
    cnt[2] -= s;
    cnt[4] += 2 * s;
    cnt[3] -= 2 * s;
  }
  if (cnt[1] || cnt[2]) return -1;
  return ans;
}
int main() {
  int i, j, l, r, x;
  scanf("%d", &n);
  for (i = 1; i <= n; ++i) {
    scanf("%d", &x);
    ++cnt[x];
    sum += x;
  }
  printf("%d\n", check());
  return 0;
}
