#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int count1 = 0;
  int count2 = 0;
  int count3 = 0;
  int count4 = 0;
  int ans = 0;
  int p;
  for (int i = 0; i < n; i++) {
    cin >> p;
    if (p == 4)
      count4++;
    else if (p == 3)
      count3++;
    else if (p == 2)
      count2++;
    else
      count1++;
  }
  ans += count4;
  ans += count3;
  count1 -= count3;
  ans += count2 / 2;
  if (count2 % 2 == 1) {
    ans += 1;
    count1 -= 2;
  }
  if (count1 > 0) {
    if (count1 % 4 == 0)
      ans += count1 / 4;
    else
      ans += count1 / 4 + 1;
  }
  cout << ans << endl;
}
