#include using namespace std; #define rep(i,n) for(int i=0,_i=(n);i<_i;++i) int main() { int N; string S; cin >> N >> S; int one = 0, nine = 0, ans = 0; rep(i, N) { if (S[i] == '3' || S[i] == '5' || S[i] == '7') ++ans; if (S[i] == '1') ++one; if (S[i] == '9') { ++nine; if (one > 0) { --one, --nine; ++ans; } } } if (nine >= one * 2) ans += one; else { ans += nine / 2; one -= nine / 2; ans += one / 2; } cout << ans << endl; return 0; }