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