#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[5] = {0};
  for (int i = 0; i < n; ++i) {
    int tmp;
    cin >> tmp;
    arr[tmp]++;
  }
  int ret = arr[4];
  ret += min(arr[1], arr[3]);
  ret += arr[2] / 2;
  if (arr[3] > arr[1]) {
    ret += arr[3] - arr[1];
    ret += (arr[2] % 2) ? 1 : 0;
  } else {
    int tmp = arr[1] - arr[3];
    ret += tmp / 4;
    if (arr[2] % 2) {
      if (tmp % 4 <= 2)
        ret += 1;
      else
        ret += 2;
    } else {
      ret += (tmp % 4) ? 1 : 0;
    }
  }
  cout << ret << endl;
  return 0;
}
