#include <bits/stdc++.h>
using namespace std;
int a[200001];
int main() {
  priority_queue<int, vector<int>, greater<int> > Q;
  priority_queue<int> Q1;
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    Q.push(a[i]);
    Q1.push(a[i]);
  }
  int num = 0;
  int flag = 0;
  while (1) {
    while (Q1.top() == 4 && Q1.size()) {
      num++;
      flag++;
      Q1.pop();
    }
    if (flag == n) break;
    if (flag == n - 1) {
      num++;
      break;
    }
    flag++;
    num++;
    int m = Q.top() + Q1.top();
    while (m <= 4 && flag < n) {
      flag++;
      Q.pop();
      m += Q.top();
    }
    Q1.pop();
  }
  printf("%d\n", num);
  return 0;
}
