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