#include <bits/stdc++.h>
using namespace std;
int main() {
  long int n, taxi = 0;
  long int countOne = 0, countTwo = 0, countThree = 0;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int num;
    cin >> num;
    if (num == 4)
      ++taxi;
    else if (num == 1)
      ++countOne;
    else if (num == 2)
      ++countTwo;
    else
      ++countThree;
  }
  long int minForOneThree = (countOne < countThree) ? countOne : countThree;
  countThree -= minForOneThree;
  countOne -= minForOneThree;
  taxi += minForOneThree;
  taxi += countThree;
  taxi += countOne / 4;
  countOne %= 4;
  taxi += countTwo / 2;
  countTwo %= 2;
  if (countTwo == 1 && countOne == 3)
    taxi += 2;
  else if (countTwo == 0 && countOne == 0)
    ;
  else
    ++taxi;
  cout << taxi << endl;
  return (0);
}
