# Predefined costs for each digit based on their structure cost = { '0': 2, '1': 3, '2': 4, '3': 4, '4': 3, '5': 4, '6': 4, '7': 3, '8': 2, '9': 3 } n = input().strip() total = 0 for c in n: total += cost[c] print(total)