n = int(input()) ok = 10**9 ng = -1 while ok - ng > 1: m = ok+ng >> 1 if n - 500*m < 100: ok = m else: ng = m print(ok)