N = raw_input() ans = len(N) * 2 hoge = [1, 0, 0, 0, 1, 0, 1, 0, 2, 1] for i in N: ans += hoge[int(i)] print ans + 1