#include <bits/stdc++.h>
using namespace std;
long long int INF = 1000000000 + 7;
const double pi = 3.141592653589;
long long int power(int base, int power) {
  long long int res = 1;
  while (power > 0) {
    if (power % 2 == 1) res = (res * base) % INF;
    power = power / 2;
    base = (base * base) % INF;
  }
  return res;
}
long long int gcd(long long int A, long long int B) {
  if (B == 0)
    return A;
  else
    return gcd(B, A % B);
}
long long int lcm(long long int A, long long int B) {
  return (A * B) / gcd(A, B);
}
int main() {
  int n;
  scanf("%d", &n);
  int a[5] = {0}, x;
  for (long long int i = 0; i < n; i++) {
    scanf("%d", &x);
    a[x]++;
  }
  int cars = a[4];
  int k = min(a[1], a[3]);
  cars += k;
  a[1] -= k;
  a[3] -= k;
  cars += a[3];
  cars += (a[2] / 2);
  if (a[2] % 2 != 0) {
    cars++;
    a[1] = a[1] - min(a[1], 2);
  }
  cars = cars + (a[1] + 3) / 4;
  cout << cars;
}
