import calendar N = int(input()) def get_swt(start, end): count = 0 for year in range(start, end): fw = calendar.weekday(year, 7, 23) if w == fw: count += 1 return count w = calendar.weekday(2014, 7, 23) x = 57 if N <= 2400: c = get_swt(2015, N+1) print(c) else: a, b = divmod(N-2400, 400) ax = a*x c = get_swt(2400, 2400+b+1) print(c+ ax + 54)