#include using namespace std; int main() { int N; cin >> N; string S; cin >> S; int one = 0, nine = 0, ret = 0; for(auto &c : S) { if(c == '3' || c == '5' || c == '7') { ++ret; } else if(c == '1') { if(nine >= 2) { --nine; --nine; ++ret; } else { ++one; } } else { ++nine; } } int v = min(one, nine); one -= v; cout << ret + v + one / 2 << endl; }