#include <bits/stdc++.h>
using namespace std;
int n, x, k, z, tot, res;
int d[10];
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> x, tot += x, d[x]++;
  if (tot < 6 && tot != 4 && tot != 3) {
    cout << -1 << endl;
    exit(0);
  }
  if (d[2] > d[1])
    k = 2;
  else
    k = 1;
  z = d[3 - k];
  res += z, d[k] -= z;
  d[3] += z;
  res += d[k] / 3 * 2, d[3] += d[k] / 3 * k, d[k] %= 3;
  if (d[k] == 1 && d[k + 2])
    ++res;
  else if (d[k])
    res += 2;
  cout << res << endl;
}
