#include <bits/stdc++.h>
int main() {
  int n = 0, b = 0, t = 0;
  int x = 0, y = 0, z = 0;
  scanf("%d", &n);
  int a[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &b);
    a[i] = b;
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == 4) {
      t++;
    } else if (a[i] == 3) {
      x++;
    } else if (a[i] == 2) {
      y++;
    } else {
      z++;
    }
  }
  t = t + x + y / 2;
  if (z >= x) {
    z = z - x;
  } else {
    z = 0;
  }
  y = y % 2;
  if (y == 1) {
    if (z > 1) {
      z = z - 2;
    } else if (z == 1) {
      z = z - 1;
    }
    t = t + z / 4;
    t = t + 1;
  }
  if (y == 0) {
    t = t + z / 4;
  }
  z = z % 4;
  if (z > 0) {
    t = t + 1;
  }
  printf("%d", t);
  return 0;
}
