时间复杂度:O(N)
空间复杂度:O(N)
动态规划。状态转移方程:
num(current_money+coin) = min(num(current_money+coin),num(current_money)+1)
coin是[1,4,16,64]的枚举

N = int(input())

num = []
for i in range(2000):
    num.append(2000)

num[0] = 0
num[1] = 1
num[4] = 1
num[16] = 1
num[64] = 1
for money in range(0,1024-N+1):
    for coin in [1,4,16,64]:
        num[money+coin] = min(num[money+coin],num[money]+1)
print(num[1024-N])