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