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