N = list(input()) N = list(map(int, N)) L = [1, 0, 0, 0, 1, 0, 1, 0, 2, 1] ans = 2 * len(N) + 1 for n in N: ans += L[n] print(ans)