#include <bits/stdc++.h>
using namespace std;
int a[5];
int n, s, ct;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < (n); i++) {
    int k;
    scanf("%d", &k);
    a[k]++;
    s += k;
  }
  if (s == 1 || s == 2 || s == 5) {
    puts("-1");
    return 0;
  }
  int m = min(a[1], a[2]);
  a[1] -= m;
  a[2] -= m;
  a[3] += m;
  ct += m;
  if (a[1] != 0) {
    m = a[1] / 3;
    a[1] -= 3 * m;
    a[3] += m;
    ct += 2 * m;
    if (a[1] == 1) {
      if (a[3] >= 1) {
        ct++;
      } else {
        ct += 2;
      }
    } else if (a[1] == 2) {
      ct += 2;
    }
  } else {
    m = a[2] / 3;
    a[2] -= 3 * m;
    a[3] += 2 * m;
    ct += 2 * m;
    if (a[2] == 1) {
      if (a[4] == 0) {
        ct += 2;
      } else {
        ct++;
      }
    } else if (a[2] == 2) {
      ct += 2;
    }
  }
  printf("%d", ct);
}
