#include <bits/stdc++.h>
using namespace std;
int n, m, p[5];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> m, ++p[m];
  if (p[3] >= p[1]) {
    if (p[2] % 2 == 0)
      cout << p[4] + p[3] + p[2] / 2;
    else
      cout << p[4] + p[3] + p[2] / 2 + 1;
  } else {
    if ((p[1] - p[3] + p[2] * 2) % 4 == 0)
      cout << p[4] + p[3] + (p[1] - p[3] + p[2] * 2) / 4;
    else
      cout << p[4] + p[3] + (p[1] - p[3] + p[2] * 2) / 4 + 1;
  }
  return 0;
}
