#include <bits/stdc++.h>
using namespace std;
string s;
int i, j, ans, k, p, n, mas[5];
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> k;
    mas[k]++;
  }
  ans = mas[4] + mas[3] + mas[2] / 2;
  mas[1] = mas[1] - mas[3];
  if (mas[2] % 2 > 0) {
    mas[1] = mas[1] - 2;
    ans++;
  }
  if (mas[1] > 0) ans += (mas[1] + 3) / 4;
  cout << ans << endl;
}
