#include <bits/stdc++.h>
using namespace std;
int arr[5];
int main() {
  int x, n;
  cin >> n;
  while (n) {
    cin >> x;
    arr[x]++;
    n--;
  }
  cout << arr[4] + arr[3] + (arr[2] * 2 + max(arr[1] - arr[3], 0) + 3) / 4
       << endl;
  return 0;
}
