#include <bits/stdc++.h>
using namespace std;
inline int read() {
  static int r, sign;
  static char c;
  r = 0, c = getchar(), sign = 1;
  while ((c < '0' || c > '9') && c != '-') c = getchar();
  if (c == '-') sign = -1, c = getchar();
  while (c >= '0' && c <= '9') r = r * 10 + (c - '0'), c = getchar();
  return r * sign;
}
template <typename T>
inline void print(T* a, int n) {
  for (int i = 1; i < n; ++i) cout << a[i] << " ";
  cout << a[n] << endl;
}
int n, c[5];
int main(int argc, char* argv[]) {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    int x;
    scanf("%d", &x);
    ++c[x];
  }
  int sum = 0, ans = 0;
  for (int i = 1; i <= 4; ++i) sum += i * c[i];
  if (sum == 5 || sum < 3)
    ans = -1;
  else {
    int c12 = min(c[1], c[2]);
    ans += c12, c[1] -= c12, c[2] -= c12, c[3] += c12;
    if (c[1] > 0) {
      ans += c[1] / 3 * 2;
      if (c[1] % 3 == 1) {
        if (c[1] > 1)
          ++ans;
        else if (c[3] > 0)
          ++ans;
        else
          ans += 2;
      }
      if (c[1] % 3 == 2) ans += 2;
    }
    if (c[2] > 0) {
      ans += c[2] / 3 * 2;
      if (c[2] % 3 == 1) {
        if (c[4] > 0)
          ++ans;
        else
          ans += 2;
      }
      if (c[2] % 3 == 2) ans += 2;
    }
  }
  printf("%d\n", ans);
  fclose(stdin);
  fclose(stdout);
  return 0;
}
