#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int A[100001];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> A[i];
  int total;
  int fours, threes, twos, ones;
  fours = threes = twos = ones = 0;
  int i = 0;
  for (i = 0; i < n; i++) {
    if (A[i] == 4) fours++;
    if (A[i] == 3) threes++;
    if (A[i] == 2) twos++;
    if (A[i] == 1) ones++;
  }
  total = fours;
  int minimun = std::min(threes, ones);
  total += minimun;
  threes -= minimun;
  ones -= minimun;
  total += threes;
  total += twos / 2;
  twos %= 2;
  if (twos == 1) {
    total += 1;
    if (ones > 0) ones -= 1;
    if (ones > 0) ones -= 1;
  }
  total += ones / 4;
  if (ones % 4 != 0) total++;
  cout << total << endl;
  return 0;
}
