#include <bits/stdc++.h>
using namespace std;
int cnt[5];
int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; ++i) {
    int t;
    cin >> t;
    ++cnt[t];
  }
  int ans = 0;
  ans += cnt[4];
  cnt[4] = 0;
  ans += cnt[3];
  cnt[1] -= min(cnt[1], cnt[3]);
  cnt[3] = 0;
  int x = cnt[2] / 2;
  ans += x;
  cnt[2] -= x * 2;
  x = cnt[2] * 2 + cnt[1];
  ans += (x + 3) / 4;
  cout << ans;
  return 0;
}
