#include <bits/stdc++.h>
int main() {
  int a[4] = {0, 0, 0, 0};
  int t, num, c = 0;
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &num);
    a[num - 1]++;
  }
  c += a[3];
  a[3] = 0;
  while (a[2] > 0) {
    if (a[0] > 0) a[0]--;
    a[2]--;
    c += 1;
  }
  while (a[1] > 0) {
    if (a[1] >= 2) {
      a[1]--;
    } else if (a[0] > 0)
      a[0] -= 2;
    a[1]--;
    c += 1;
  }
  while (a[0] > 0) {
    a[0] -= 4;
    c++;
  }
  printf("%d\n", c);
  return 0;
}
