#include <bits/stdc++.h>
using namespace std;
int ara[5];
int main() {
  int a, b, i, taxi = 0, x;
  scanf("%d", &a);
  for (i = 0; i < a; i++) {
    scanf("%d", &b);
    ara[b]++;
  }
  taxi += ara[4];
  taxi += ara[3];
  x = min(ara[3], ara[1]);
  ara[1] -= x;
  x = (ara[2] * 2) + ara[1];
  taxi += (x / 4) + ((x % 4) ? 1 : 0);
  printf("%d\n", taxi);
  return 0;
}
