#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, a[6] = {0}, num, car = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> num;
    a[num]++;
  }
  car += a[4];
  if (a[3] > 0) {
    car += a[3];
    a[1] -= a[3];
  }
  if (a[2] > 0) {
    if (a[2] % 2 == 0) {
      car += (a[2] / 2);
    } else {
      car += (a[2] / 2);
      if (a[1] > 0) {
        car++;
        a[1] -= 2;
      } else
        car++;
    }
  }
  if (a[1] > 0) {
    if (a[1] % 4 == 0) {
      car += (a[1] / 4);
    } else {
      car = car + (a[1] / 4) + 1;
    }
  }
  cout << car << endl;
}
