#include #define FOR(i, a, b) for(int (i) = (a); (i) < (b); ++(i)) #define REP(i, n) FOR(i, 0, n) constexpr int MAX_SIZE = 2e5; char str[MAX_SIZE + 10]; int main(void){ int n; scanf("%d%s", &n, str); int res = 0, one = 0, nine = 0; REP(i, n){ switch(str[i]){ case '1': if(nine >= 2){ nine -= 2; res++; } else if(one >= 1){one--; res++;} else one++; break; case '3': case '5': case '7': res++; break; case '9': if(one >= 1){one--; res++;} else nine++; break; } } printf("%d\n", res); return 0; }