#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> passenger;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    passenger.push_back(x);
  }
  sort(passenger.begin(), passenger.end());
  int i = 0;
  int j = n - 1;
  int taxi = 0;
  while (i != j) {
    if (passenger[i] + passenger[j] <= 4) {
      int temp = passenger[j];
      passenger[j] = passenger[i] + temp;
      i++;
    } else {
      taxi++;
      j--;
    }
  }
  taxi++;
  cout << taxi;
  return 0;
}
