#include <bits/stdc++.h>
using namespace std;
int f[5];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    ++f[a];
  }
  int res = f[4];
  int mn = min(f[3], f[1]);
  res += mn;
  f[3] -= mn, f[1] -= mn;
  res += f[3];
  f[2] += f[1] / 2;
  res += (f[2]) / 2;
  if (f[2] % 2 == 1)
    f[2] = 1;
  else
    f[2] = 0;
  if (f[1] % 2 == 1) ++f[2];
  if (f[2]) ++res;
  cout << res << endl;
  return 0;
}
