#include <bits/stdc++.h>
using namespace std;
int main() {
  const int MAXS = 4 + 1;
  vector<int> cnt(MAXS);
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int s;
    scanf("%d", &s);
    ++cnt[s];
  }
  int res = cnt[4];
  cnt[4] = 0;
  res += cnt[2] / 2;
  cnt[2] %= 2;
  int oneAndThree = min(cnt[1], cnt[3]);
  res += oneAndThree;
  cnt[1] -= oneAndThree;
  cnt[3] -= oneAndThree;
  res += cnt[3];
  cnt[3] = 0;
  if (cnt[2]) {
    ++res;
    cnt[2] = 0;
    cnt[1] -= min(cnt[1], 2);
  }
  res += cnt[1] / 4 + (cnt[1] % 4 != 0);
  cout << res << endl;
  return 0;
}
