#include <bits/stdc++.h>
using namespace std;
long long Pow(long long B, long long P) {
  long long R = 1;
  while (P > 0) {
    if (P & 1) R = (R * B);
    P /= 2;
    B = (B * B);
  }
  return R;
}
bool isVowel(char s) {
  s = tolower(s);
  if (s == 'a' || s == 'e' || s == 'i' || s == 'o' || s == 'u') return true;
  return false;
}
long long GCD(long long a, long long b) {
  while (b) {
    b ^= a ^= b ^= a %= b;
  }
  return a;
}
long long LCM(long long a, long long b) { return (a / GCD(a, b) * b); }
long long BigMod(long long B, long long P, long long M) {
  long long R = 1;
  while (P > 0) {
    if (P & 1) {
      R = (R * B) % M;
    }
    P /= 2;
    B = (B * B) % M;
  }
  return (long long)R;
}
string i2b(long long a) {
  string s;
  do {
    s += (a & 1) + '0', a >>= 1;
  } while (a);
  reverse(s.begin(), s.end());
  return s;
}
long long toInt(string s) {
  long long r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
string toString(long long number) {
  stringstream ss;
  ss << number;
  return ss.str();
}
int Cnt[10], Nxt[10], Curr[10];
int res;
int main() {
  int N = ({
    int a;
    scanf("%d", &a);
    a;
  }),
      tot = 0;
  memset(Cnt, 0, sizeof Cnt);
  for (__typeof(N) i = 0; i < N; i++) {
    int x = ({
      int a;
      scanf("%d", &a);
      a;
    });
    x = 4 - x;
    tot += x, Cnt[x]++;
  }
  res = 1000000000;
  for (int i = 0; i * 4 <= tot; i++) {
    int j = tot - i * 4;
    if (j + i > N) continue;
    for (__typeof(5) i = 0; i < 5; i++) Curr[i] = Cnt[i];
    memset(Nxt, 0, sizeof Nxt);
    Nxt[0] = N - j - i;
    Nxt[1] = j;
    Nxt[4] = i;
    int I = 0, J = 0, cnt = 0;
    while (1) {
      while (I < 5 && !Curr[I]) I++;
      if (I == 5) {
        break;
      }
      while (J < 5 && !Nxt[J]) J++;
      if (J == 5) {
        break;
      }
      int pp = min(Curr[I], Nxt[J]);
      cnt += pp * abs(J - I);
      Curr[I] -= pp;
      Nxt[J] -= pp;
    }
    cnt >>= 1;
    res = min(res, cnt);
  }
  printf("%d\n", res == 1000000000 ? -1 : res);
}
