#include <bits/stdc++.h>
int n, i, s[100001], val[5], hasil;
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &s[i]);
    val[s[i]] += 1;
  }
  hasil += val[4];
  val[4] = 0;
  hasil += val[3];
  val[1] -= val[3];
  if (val[1] < 0) val[1] = 0;
  val[3] = 0;
  hasil += val[2] / 2;
  val[2] = val[2] % 2;
  hasil += val[1] / 4;
  val[1] %= 4;
  if (val[2] == 1) {
    hasil += val[2];
    val[1] -= 2;
  }
  if (val[1] < 0) val[1] = 0;
  if (val[1] > 0) hasil += 1;
  printf("%d\n", hasil);
  return 0;
}
