#include <bits/stdc++.h>
int i, top = 0, j, t = 0, arr[4], n, h;
int main() {
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &h);
    arr[h]++;
  }
  for (i = 0; i < n; i++) {
    for (j = 4; j > 0; j--)
      while (j + t <= 4 && arr[j] >= 1) {
        t += j;
        arr[j]--;
      }
    if (t != 0) top++;
    if (arr[1] == 0 && arr[2] == 0 && arr[3] == 0 && arr[4] == 0) break;
    t = 0;
  }
  printf("%d", top);
  return 0;
}
