#include <bits/stdc++.h>
using namespace std;
int main() {
  long int n, i, s[100000], sum = 0, d = 0, k1 = 0, k2 = 0, k3 = 0, x, k4 = 0;
  cin >> n;
  for (i = 1; i <= n; i++) cin >> s[i];
  for (i = 1; i <= n; i++) {
    if (s[i] == 4) k4++;
    if (s[i] == 1) k1++;
    if (s[i] == 2) k2++;
    if (s[i] == 3) k3++;
  }
  if (k3 >= k1)
    k1 = 0;
  else
    k1 -= k3;
  k2 = 2 * k2 + k1;
  if (k2 % 4 != 0)
    k2 = k2 / 4 + 1;
  else
    k2 = k2 / 4;
  d = k4 + k3 + k2;
  cout << d;
  return 0;
}
