s = input()
cnt = 0
for i in s:
    if i == '0':
        cnt += 1
    elif i == '6':
        cnt += 1
    elif i == '9':
        cnt += 1
    elif i == '8':
        cnt += 2
print(cnt)