#include <bits/stdc++.h>
int main() {
  int rt;
  int n;
  int i, t;
  int s[4];
  scanf("%d", &n);
  for (i = 0; i < 4; i++) {
    s[i] = 0;
  }
  for (i = 0; i < n; i++) {
    int st;
    scanf("%d", &st);
    s[st - 1]++;
  }
  rt = s[3];
  s[3] = 0;
  t = fmin(s[2], s[0]);
  rt = rt + t;
  s[2] = s[2] - t;
  s[0] = s[0] - t;
  rt = rt + trunc(s[1] / 2);
  s[1] = s[1] - 2 * trunc(s[1] / 2);
  t = fmin(s[1], trunc(s[0] / 2));
  rt = rt + t;
  s[1] = s[1] - t;
  s[0] = s[0] - 2 * t;
  rt = rt + trunc(s[0] / 4);
  s[0] = s[0] - 4 * trunc(s[0] / 4);
  rt = rt + s[2];
  s[2] = 0;
  t = fmin(s[1], s[0]);
  rt = rt + t;
  s[1] = s[1] - t;
  s[0] = s[0] - t;
  rt = rt + trunc(s[0] / 3);
  s[0] = s[0] - 3 * trunc(s[0] / 3);
  rt = rt + s[1];
  s[1] = 0;
  rt = rt + trunc(s[0] / 2);
  s[0] = s[0] - 2 * trunc(s[0] / 2);
  rt = rt + s[0];
  s[0] = 0;
  printf("%d", rt);
  return 0;
}
