#include <bits/stdc++.h>
using namespace std;
int n;
int cs[5];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    cs[a]++;
  }
  bool ng = false;
  int ret = 0;
  int m = min(cs[1], cs[2]);
  ret += m;
  cs[1] -= m;
  cs[2] -= m;
  cs[3] += m;
  if (cs[1]) {
    int v = cs[1] / 3;
    ret += 2 * v;
    cs[3] += v;
    cs[1] -= 3 * v;
    switch (cs[1]) {
      case 1:
        if (cs[3]) {
          ret++;
        } else if (cs[4] >= 2) {
          ret += 2;
        } else {
          ng = true;
        }
        break;
      case 2:
        if (cs[4]) {
          ret += 2;
        } else if (cs[3] >= 2) {
          ret += 2;
        } else {
          ng = true;
        }
        break;
    }
  } else if (cs[2]) {
    int v = cs[2] / 3;
    ret += 2 * v;
    cs[3] += 2 * v;
    cs[2] -= 3 * v;
    switch (cs[2]) {
      case 1:
        if (cs[4]) {
          ret++;
        } else if (cs[3] >= 2) {
          ret += 2;
        } else {
          ng = true;
        }
        break;
      case 2:
        ret += 2;
        break;
    }
  }
  if (ng) {
    cout << -1 << endl;
  } else {
    cout << ret << endl;
  }
}
