def is_leap(n): if n % 400 == 0: return True if n % 100 == 0: return False if n % 4 == 0: return True return False def loop_count(start, end): total = 0 diff = 0 for i in range(start, end+1): if is_leap(i): diff += 2 else: diff += 1 if diff % 7 == 0: total += 1 diff = 0 return total N = int(input()) total = 0 if N <= 2414: total = loop_count(2015, N) else: total = loop_count(2015, 2414) total *= (N-2014) // 400 total += loop_count(2014 + (N-2014)//400*400 + 1, N) print(total)