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