#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, a[5] = {0};
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    a[x]++;
  }
  int res = a[4];
  res += a[2] / 2;
  a[2] = a[2] % 2;
  if (a[2] == 1) {
    res++;
    a[1] -= 2;
  }
  res += a[3];
  if (a[1] > a[3]) {
    a[1] -= a[3];
    res += (a[1] + 3) / 4;
  }
  cout << res;
  return 0;
}
