def readint(): return map(int, input().split()) n = int(input()) ans = n // 500 n %= 500 print(ans + 1 if n >= 100 else ans)