#include <bits/stdc++.h>
using namespace std;
int s[100005];
int book[4];
int main() {
  int n, i, t;
  memset(book, 0, sizeof(book));
  memset(s, 0, sizeof(s));
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &s[i]);
  }
  for (i = 0; i < n; i++) {
    book[s[i]]++;
  }
  int count = 0;
  count += book[4] + book[3];
  book[1] -= book[3];
  if (book[2] % 2 == 0)
    count += book[2] / 2;
  else {
    count += (book[2] + 1) / 2;
    book[1] -= 2;
  }
  if (book[1] > 0) {
    if (book[1] % 4 == 0)
      count += book[1] / 4;
    else
      count += book[1] / 4 + 1;
  }
  printf("%d", count);
  return 0;
}
