#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int a[5];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  int tot = 0;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    tot += x;
    a[x]++;
  }
  if (tot < 3 or tot == 5) {
    cout << -1 << '\n';
    ;
    return 0;
  }
  int k = min(a[1], a[2]);
  a[1] -= k;
  a[2] -= k;
  a[3] += k;
  int ans = k;
  if (a[1] > 0) {
    k = a[1] / 3;
    int rem = a[1] % 3;
    a[3] += k;
    ans += 2 * k;
    if (rem == 1) {
      if (a[3] > 0)
        ans++;
      else
        ans += 2;
    } else if (rem == 2) {
      ans += 2;
    }
  } else if (a[2] > 0) {
    k = a[2] / 3;
    int rem = a[2] % 3;
    ans += 2 * k;
    if (rem == 2)
      ans += 2;
    else if (rem == 1) {
      if (a[4] > 0)
        ans++;
      else
        ans += 2;
    }
  }
  cout << ans << '\n';
  ;
  return 0;
}
