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