ans = 0 s = input() for i in s: if i in "0469": ans += 1 elif i in "8": ans += 2 ans += 1 print(ans + len(s) * 2)