program main
	implicit none
    integer::a,ans,i
    read(*,*) a
    ans=0
    do i=1,4
    	if(mod(a,10)==2)then
        	ans=ans+1
            
        end if
        a=a/10
    end do
    stop
end program main