#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int count;
  int n;
  int rub;
  int a[100000];
  int b[100000];
  int a_1234[4] = {0, 0, 0, 0};
  int sum = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> rub;
    a_1234[rub - 1]++;
  }
  sum = a_1234[3] + a_1234[2];
  a_1234[0] -= a_1234[2];
  if (a_1234[0] < 0) a_1234[0] = 0;
  sum += a_1234[1] / 2;
  a_1234[1] = a_1234[1] % 2;
  sum += (a_1234[1] * 2 + a_1234[0]) / 4;
  if ((a_1234[1] * 2 + a_1234[0]) % 4 != 0) sum++;
  cout << sum;
  getchar();
  getchar();
  return 0;
}
