#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
  int i, n, k, a, kil = 0;
  int mas[10];
  cin >> n;
  for (i = 1; i <= 5; i++) mas[i] = 0;
  for (i = 1; i <= n; i++) {
    cin >> a;
    mas[a]++;
  }
  if (mas[1] < mas[3]) {
    kil = kil + mas[1];
    mas[3] = mas[3] - mas[1];
    mas[1] = 0;
    kil = kil + mas[3];
    mas[3] = 0;
  } else {
    kil = kil + mas[3];
    mas[1] = mas[1] - mas[3];
    mas[3] = 0;
  }
  kil = kil + mas[4];
  mas[4] = 0;
  kil = kil + mas[1] / 4;
  mas[1] = mas[1] % 4;
  kil = kil + mas[2] / 2;
  mas[2] = mas[2] % 2;
  if (mas[2] == 1) {
    if (mas[1] <= 2)
      kil++;
    else
      kil = kil + 2;
  } else if (mas[1] > 0)
    kil++;
  cout << kil;
}
