#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void CLR(T& A) {
  A.clear();
}
inline bool insize(int c, int l, int r) {
  if (c >= l && c <= r) return true;
  return false;
}
template <class T>
inline void checkmin(T& a, T b) {
  if (a == -1 || a > b) a = b;
}
template <class T>
inline void checkmax(T& a, T b) {
  if (a < b) a = b;
}
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
int dy[] = {1, 0, -1, 0, 1, -1, 1, -1};
int sig(double x) { return fabs(x - 0) < 1e-8 ? 0 : x > 0 ? 1 : -1; }
template <class T>
inline void sf(T& x) {
  char c;
  int mul = 1;
  while ((c = getchar()) != EOF) {
    if (c == '-') mul = -1;
    if (c >= '0' && c <= '9') {
      x = c - '0';
      break;
    }
  }
  if (c == EOF) {
    x = EOF;
    return;
  }
  while ((c = getchar())) {
    if (c >= '0' && c <= '9') {
      x = (x << 1) + (x << 3) + (c - '0');
    } else
      break;
  }
  x *= mul;
}
template <class T0, class T1>
inline void sf(T0& x, T1& y) {
  sf(x);
  sf(y);
}
template <class T0, class T1, class T2>
inline void sf(T0& x, T1& y, T2& z) {
  sf(x);
  sf(y);
  sf(z);
}
const int N = 1000005;
const int E = 200055;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3F3F3F3F3F3F3F3FLL;
int n, sum, c1, c2, c3, c4, ans;
int main() {
  sf(n);
  ans = sum = c1 = c2 = c3 = c4 = 0;
  for (int i = 0; i < n; i++) {
    int x;
    sf(x);
    ;
    if (x == 1)
      c1++;
    else if (x == 2)
      c2++;
    else if (x == 4)
      c4++;
    else if (x == 3)
      c3++;
    sum += x;
  }
  if (sum == 1 || sum == 2 || sum == 5) {
    puts("-1");
    return 0;
  }
  ans = min(c1, c2);
  c1 -= ans;
  c2 -= ans;
  c3 += ans;
  if (c1 > 0) {
    int t = c1 / 3;
    ans += t * 2;
    c3 += t;
    c1 = c1 % 3;
    if (c1 == 1) {
      if (c3 > 0)
        ans++;
      else
        ans += 2;
    } else if (c1 == 2) {
      ans += 2;
    }
  } else if (c2 > 0) {
    ans += ((c2 - 1) / 3 + 1) * 2;
    if ((c2 - 1) % 3 == 0 && c4 > 0) ans--;
  }
  cout << ans << endl;
}
