import sys

str=input()
count=0
for char in str:
    if char in '069':
        count+=1
    if char in '8':
        count+=2
print(count)