#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, s, t, i, j, a, b, c, cnt1 = 0, sum1 = 0, sum = 0;
  int one = 0, two = 0, three = 0, four = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a;
    if (a == 1) {
      one++;
    } else if (a == 2) {
      two++;
    } else if (a == 3) {
      three++;
    } else {
      four++;
    }
  }
  cnt1 = cnt1 + three;
  one = one - three;
  if (two % 2 == 0) {
    cnt1 = cnt1 + two / 2;
  } else {
    cnt1 = cnt1 + two / 2 + 1;
    one = one - 2;
  }
  if (one > 0) {
    if (one % 4 == 0) {
      cnt1 = cnt1 + one / 4;
    } else {
      cnt1 = cnt1 + one / 4 + 1;
    }
  }
  cout << cnt1 + four << endl;
  return 0;
}
