# 背景は共通なので背景を抜いた各数字のregion数は # 2 for [1, 2, 3, 5, 7], 3 for [0, 4, 6, 9], and 4 for [8] # 与えられたNの各数字のregion数を上に従って数え上げ、背景分の+1をしたら答えか N = input() region_count = 0 for i in range(len(N)): if int(N[i]) in [1, 2, 3, 5, 7]: region_count += 2 elif int(N[i]) in [0, 4, 6, 9]: region_count += 3 elif int(N[i]) == 8: region_count += 4 region_count += 1 print(region_count)