#include <bits/stdc++.h>
using namespace std;
long long a[100005], n, s, ans;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  while (n--) {
    long long x;
    cin >> x;
    s += x;
    a[x]++;
  }
  if (s == 1 or s == 2 or s == 5) return cout << -1, 0;
  while (a[1] > 0 and a[2] > 0) {
    a[3]++;
    ans++;
    a[1]--;
    a[2]--;
  }
  if (a[1] > 0) {
    ans += a[1] - a[1] / 3;
    if (a[1] == 1 and a[3] == 0) ans++;
  }
  if (a[2] > 0) {
    ans += a[2] - a[2] / 3;
    if (a[2] % 3 == 1 and a[4] == 0) ans++;
  }
  cout << ans;
  return 0;
}
