#include <bits/stdc++.h>
using namespace std;
int main() {
  int Group, Taxi = 0, One = 0, Two = 0, Three = 0;
  cin >> Group;
  for (int i = 0; i < Group; i++) {
    int Student;
    cin >> Student;
    if (Student == 1)
      One++;
    else if (Student == 2)
      Two++;
    else if (Student == 3)
      Three++;
    else
      Taxi++;
  }
  Taxi += Three;
  One -= Three;
  Taxi += (Two / 2);
  Two -= (Two / 2 * 2);
  if (Two) {
    Taxi++;
    One -= 2;
  }
  if (One > 0) {
    Taxi += (One / 4);
    One -= (One / 4 * 4);
    if (One > 0) Taxi++;
  }
  cout << Taxi << endl;
  return 0;
}
