#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> c(5);
  int N = 0, m = 0, a;
  for (int i = 0; i < n; ++i) {
    cin >> a;
    ++c[a];
    N += a;
  }
  if (N < 3 || N == 5) {
    cout << -1 << endl;
    return 0;
  }
  int d = min(c[1], c[2]);
  c[1] -= d;
  c[2] -= d;
  c[3] += d;
  m += d;
  if (c[1]) {
    d = c[1] / 3;
    m += d * 2;
    c[3] += d;
    c[1] %= 3;
    m += (!c[1] ? 0 : c[1] == 1 && c[3] ? 1 : 2);
  } else if (c[2]) {
    d = 2 * (c[2] / 3);
    m += d;
    c[3] += d;
    c[2] %= 3;
    m += (!c[2] ? 0 : c[2] == 1 && c[4] ? 1 : 2);
  }
  cout << m << endl;
  return 0;
}
