#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, taxy = 0, group = 0;
  register int groups[4] = {0, 0, 0, 0};
  cin >> n;
  for (register int i = 0; i < n; i++) {
    cin >> group;
    groups[group - 1]++;
  }
  taxy = groups[3];
  taxy += groups[2];
  groups[0] -= groups[2];
  taxy += groups[1] / 2;
  if (groups[1] % 2) {
    taxy++;
    groups[0] -= 2;
  }
  if (groups[0] > 0) {
    taxy += ((groups[0] % 4) ? (groups[0] / 4) + 1 : groups[0] / 4);
  }
  cout << taxy;
  return 0;
}
