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