#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, e, count1 = 0, count2 = 0, count3 = 0, final = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> e;
    if (e == 4)
      final++;
    else if (e == 3)
      count3++;
    else if (e == 1)
      count1++;
    else
      count2++;
  }
  final += count3;
  if (count3 >= count1)
    count1 = 0;
  else
    count1 -= count3;
  count3 = 0;
  if (count2 % 2 == 0) {
    final += count2 / 2;
    count2 = 0;
  } else {
    final += (count2 + 1) / 2;
    count2 = 0;
    if (count1 > 0) count1 -= 2;
  }
  if (count1 > 0) final += (count1 + 3) / 4;
  cout << final;
  return 0;
}
