#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;
  }
  int used = 0;
  {
    int t = min(cnt[1], cnt[2]);
    cnt[1] -= t;
    cnt[2] -= t;
    cnt[3] += t;
    used += t;
  }
  {
    int t = cnt[1] / 3;
    cnt[3] += t;
    used += t * 2;
    cnt[1] %= 3;
  }
  {
    int t = cnt[2] / 3;
    cnt[3] += t * 2;
    used += t * 2;
    cnt[2] %= 3;
  }
  if (cnt[1] == 1) {
    if (cnt[3])
      ++used;
    else
      used += 2;
  } else if (cnt[1] == 2) {
    if (cnt[4])
      used += 2;
    else
      used += 2;
  } else if (cnt[2] == 1) {
    if (cnt[4])
      ++used;
    else
      used += 2;
  } else if (cnt[2] == 2) {
    used += 2;
  }
  printf("%d\n", used);
  return 0;
}
