#include <bits/stdc++.h>
using namespace std;
int arr[5] = {0};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n, x;
  cin >> n;
  while (n--) {
    cin >> x;
    arr[x]++;
  }
  int res = 0;
  for (int i = 4; i >= 1; i--) {
    while (arr[i] > 0) {
      int p = 0;
      int j = i;
      while (j > 0 && p < 4) {
        if (arr[j] > 0 && p + j <= 4) {
          arr[j]--;
          p += j;
        } else {
          j--;
        }
      }
      res++;
    }
  }
  cout << res << '\n';
  return 0;
}
