n = int(input()) q = n // 500 if n - q * 500 < 100: print(q) else: print(q + 1)