#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
int a[MAXN];
bool cmp(int a, int b) { return a > b; }
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n, cmp);
  int count = 0, sum = 0;
  for (int i = 0; i < n; i++) {
    int sum = a[i] + a[n - 1];
    if (sum <= 4) {
      count++;
      n--;
      while (sum + a[n - 1] <= 4) {
        n--;
        sum += a[n - 1];
      }
    } else
      count++;
  }
  cout << count << endl;
  return 0;
}
