N = int(input()) x = N // 500 if N - 500 * x < 100: print(x) else: print(x + 1) # TODO: write code...