#include <bits/stdc++.h>
using namespace std;
const int MAX = 1000005;
int a[MAX], c[5];
int main() {
  ios::sync_with_stdio(false);
  int n, sum = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
    c[a[i]]++;
  }
  if (sum == 1 || sum == 2 || sum == 5) {
    cout << -1;
    return 0;
  }
  int ans = 0, val;
  val = min(c[1], c[2]);
  ans += val;
  c[3] += val;
  c[1] -= val;
  c[2] -= val;
  if (c[1]) {
    val = (c[1] / 3) * 2;
    ans += val;
    c[3] += c[1] / 3;
    c[1] %= 3;
    if (c[1] == 2) ans += 2;
    if (c[1] == 1)
      if (c[3])
        ans++;
      else
        ans += 2;
  }
  if (c[2]) {
    val = (c[2] / 3) * 2;
    ans += val;
    c[3] += val;
    c[2] %= 3;
    if (c[2] == 2) ans += 2;
    if (c[2] == 1)
      if (c[4])
        ans++;
      else
        ans += 2;
  }
  cout << ans;
  return 0;
}
