#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int ar[5] = {};
  int sum = 0;
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    sum += a;
    ar[a]++;
  }
  int ans = -1;
  for (int i = 0; i * 3 <= sum; i++) {
    int rec = sum - i * 3;
    if (rec % 4 != 0) continue;
    rec /= 4;
    int tmp = 0;
    int br[5];
    for (int j = 0; j < 5; j++) {
      br[j] = ar[j];
    }
    if (br[4] >= rec) {
      br[4] -= rec;
      rec = 0;
    } else {
      rec -= br[4];
      br[4] = 0;
      int add = min(rec, min(br[1], br[3]));
      br[1] -= add;
      br[3] -= add;
      tmp += add;
      rec -= add;
      add = min(rec, min(br[2], br[1] / 2));
      br[2] -= add;
      br[1] -= add * 2;
      tmp += add * 2;
      rec -= add;
      add = min(rec, br[1] / 4);
      br[1] -= add * 4;
      tmp += add * 3;
      rec -= add;
      add = min(rec, br[2] / 2);
      br[2] -= add * 2;
      tmp += add * 2;
      rec -= add;
      add = min(rec, min(br[3] / 2, br[2]));
      tmp += add * 2;
      rec -= add * 2;
      br[3] -= add * 2;
      br[2] -= add;
    }
    br[3] += br[4];
    br[1] += br[4];
    int red = br[4];
    tmp += br[4];
    br[4] = 0;
    if (rec != 0) continue;
    rec = i;
    rec -= br[3];
    br[3] = 0;
    int add = min(rec, min(br[1], br[2]));
    br[1] -= add;
    br[2] -= add;
    tmp += add;
    rec -= add;
    add = min(add, red);
    tmp -= add;
    red -= add;
    add = min(rec, br[1] / 3);
    br[1] -= add * 3;
    tmp += add * 2;
    rec -= add;
    add = min(add * 2, red);
    tmp -= add;
    red -= add;
    add = min(rec, br[2] / 3);
    br[2] -= add * 3;
    tmp += add * 2;
    rec -= add * 2;
    if (ans == -1 || ans > tmp) {
      ans = tmp;
    }
  }
  printf("%d\n", ans);
}
