#include <bits/stdc++.h>
using namespace std;
const int inf = 2000000000;
static inline int Rint() {
  struct X {
    int dig[256];
    X() {
      for (int i = '0'; i <= '9'; ++i) dig[i] = 1;
      dig['-'] = 1;
    }
  };
  static X fuck;
  int s = 1, v = 0, c;
  for (; !fuck.dig[c = getchar()];)
    ;
  if (c == '-')
    s = 0;
  else if (fuck.dig[c])
    v = c ^ 48;
  for (; fuck.dig[c = getchar()]; v = v * 10 + (c ^ 48))
    ;
  return s ? v : -v;
}
template <typename T>
static inline void cmax(T& a, const T& b) {
  if (b > a) a = b;
}
template <typename T>
static inline void cmin(T& a, const T& b) {
  if (b < a) a = b;
}
const int maxn = 100005;
int main() {
  int cnt[5] = {0};
  const int n = Rint();
  int s = 0;
  for (int i = 0; i < n; ++i) {
    const int t = Rint();
    s += t;
    ++cnt[t];
  }
  if (s == 1 || s == 2 || s == 5) {
    puts("-1");
    return 0;
  }
  if (s == 0) {
    puts("0");
    return 0;
  }
  if (cnt[1] == 0 && cnt[2] == 0) {
    puts("0");
    return 0;
  }
  const int total = s;
  int need = inf;
  for (int four = 0;; ++four) {
    if (four * 4 > s) break;
    const int other = s - four * 4;
    if (other % 3) continue;
    const int three = other / 3;
    int local_cnt[5];
    memcpy(local_cnt, cnt, sizeof(cnt));
    int x = three, y = four;
    int keep = 0;
    int t = min(local_cnt[3], x);
    x -= t;
    local_cnt[3] -= t;
    keep += t * 3;
    t = min(local_cnt[4], y);
    y -= t;
    local_cnt[4] -= t;
    keep += t * 4;
    for (int i = 4; i >= 1; --i) {
      int t = min(y, local_cnt[i]);
      local_cnt[i] -= t;
      y -= t;
      keep += t * i;
    }
    for (int i = 4; i >= 1; --i) {
      int t = min(x, local_cnt[i]);
      local_cnt[i] -= t;
      x -= t;
      keep += t * min(i, 3);
    }
    int ans = total - keep;
    cmin(need, ans);
  }
  printf("%d\n", need);
  return 0;
}
