N = input().strip() k = len(N) num = {"0":1,"1":0,"2":0,"3":0,"4":1,"5":0,"6":1,"7":0,"8":2,"9":1} ans = 2*k+1 for x in N: ans += num[x] print(ans)