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