n = int(input()) count = 0 base_leap = (2014 // 4) - (2014 // 100) + (2014 // 400) # Precomputed for 2014 for y in range(2015, n + 1): # Calculate the number of leap years from 2015 to y inclusive leap = (y // 4) - (y // 100) + (y // 400) - base_leap total_days = (y - 2014) * 365 + leap if total_days % 7 == 0: count += 1 print(count)