def main(): n = int(input()) n = 1024 - n res = 0 coins = [64, 16, 4, 1] for c in coins: res += n // c n = n % c print(res) main()