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