#include <bits/stdc++.h>
using namespace std;
int n, i, nr, k[7], m;
int main(void) {
  cin >> n;
  m = 0;
  for (i = 1; i <= n; i++) {
    cin >> nr;
    k[nr]++;
  }
  if ((k[1] + k[2] * 2 + k[3] * 3 + k[4] * 4 == 5) ||
      (k[1] + k[2] * 2 + k[3] * 3 + k[4] * 4 < 3)) {
    cout << "-1";
    return 0;
  }
  if (k[2] > k[1]) {
    k[2] = k[2] - k[1];
    k[3] = k[3] + k[1];
    m = m + k[1];
    k[1] = 0;
    m = m + (k[2] / 3) * 2;
    k[3] = k[3] + (k[2] / 3) * 2;
    k[2] = k[2] % 3;
    if (k[2] == 1) {
      if (k[4] > 0)
        m++;
      else
        m = m + 2;
    } else if (k[2] == 2) {
      m = m + 2;
    }
  } else if (k[2] < k[1]) {
    m = m + k[2];
    k[3] = k[3] + k[2];
    k[1] = k[1] - k[2];
    k[2] = 0;
    k[3] = k[3] + k[1] / 3;
    m = m + (k[1] / 3) * 2;
    k[1] = k[1] % 3;
    if (k[3] != 0)
      m = m + k[1];
    else
      m = m + 2;
  } else if (k[2] == k[1])
    m = k[1];
  cout << m;
  return 0;
}
