#include <bits/stdc++.h>
using namespace std;
int p[5];
int main() {
  int n, ans = 0, sum = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    p[x]++;
    sum += x;
  }
  if (sum == 1 || sum == 2 || sum == 5) {
    cout << -1 << endl;
    return 0;
  }
  int x = min(p[1], p[2]);
  ans += x;
  p[1] -= x;
  p[2] -= x;
  p[3] += x;
  if (p[1]) {
    ans += p[1] / 3 * 2;
    p[3] += p[1] / 3;
    p[1] %= 3;
    if (p[1] == 1) {
      if (p[3])
        ans++;
      else
        ans += 2;
    }
    if (p[1] == 2) {
      ans += 2;
    }
  }
  if (p[2]) {
    ans += p[2] / 3 * 2;
    p[3] += p[2] / 3 * 2;
    p[2] %= 3;
    if (p[2] == 1) {
      if (p[4])
        ans++;
      else
        ans += 2;
    }
    if (p[2] == 2) {
      ans += 2;
    }
  }
  cout << ans << endl;
}
