while 1:print sum((x in'069')+(x=='8')*2for x in raw_input())