#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, f = 0, th = 0, tw = 0, o = 0;
  cin >> m;
  for (long long int i = 0; i < m; i++) {
    cin >> n;
    if (n == 4)
      f++;
    else if (n == 3)
      th++;
    else if (n == 2)
      tw += 2;
    else
      o++;
  }
  (th >= o) ? o = 0 : o -= th;
  ((o + tw) % 4 == 0) ? tw = (o + tw) / 4 : tw = ((o + tw) / 4) + 1;
  cout << (f + th + tw) << endl;
  return 0;
}
