#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x;
  cin >> n;
  int arr[5];
  arr[0] = arr[1] = arr[2] = arr[3] = arr[4] = 0;
  for (int i = 0; i < n; i++) {
    cin >> x;
    arr[x]++;
  }
  if (arr[3] >= arr[1])
    arr[1] = 0;
  else
    arr[1] -= arr[3];
  if (arr[2] & 1) {
    arr[2]++;
    arr[1] -= 2;
    arr[1] = arr[1] < 0 ? 0 : arr[1];
  }
  arr[2] /= 2;
  arr[1] = arr[1] % 4 == 0 ? (arr[1] / 4) : (arr[1] / 4 + 1);
  cout << (arr[1] + arr[2] + arr[3] + arr[4]) << endl;
}
