n=input() count=1+2*len(n) for i in n: i = int(i) if i in (0,4,6,9): count+=1 if i==8: count+=2 print(count)