#include <bits/stdc++.h>
using namespace std;
void no() {
  cout << "-1\n";
  exit(0);
}
void yes() { cout << "YES\n"; }
int nxt() {
  int x;
  cin >> x;
  return x;
}
void solve() {
  int n = nxt();
  vector<int> a(5);
  for (int i = (int)0; i < (int)n; i++) a[nxt()]++;
  int ans = 0;
  int x = min(a[1], a[2]);
  ans += x;
  a[1] -= x, a[2] -= x, a[3] += x;
  if (a[1]) {
    x = a[1] / 3;
    ans += x * 2, a[1] %= 3, a[3] += x;
    if (a[1] == 1) {
      if (a[3] > 0)
        ans++;
      else if (a[4] >= 2)
        ans += 2;
      else
        no();
    } else if (a[1] == 2) {
      if (a[4] > 0)
        ans += 2;
      else if (a[3] >= 2)
        ans += 2;
      else
        no();
    }
  } else if (a[2]) {
    x = a[2] / 3;
    ans += x * 2, a[2] %= 3, a[3] += x * 2;
    if (a[2] == 1) {
      if (a[4] > 0)
        ans++;
      else if (a[3] >= 2)
        ans += 2;
      else
        no();
    } else if (a[2] == 2) {
      ans += 2;
    }
  }
  cout << ans << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  for (int tc = 1; tc <= t; tc++) {
    solve();
  }
}
