def compute_cycle_count(): count = 0 for y in range(400): a = y + y // 4 - y // 100 if a % 7 == 3: count += 1 return count cycle_count = compute_cycle_count() n = int(input()) if n < 2015: print(0) else: start = 2015 end = n total_years = end - start + 1 full_cycles = total_years // 400 remaining = total_years % 400 count = full_cycles * cycle_count # Check remaining years for y in range(start + full_cycles * 400, end + 1): a = y + y // 4 - y // 100 + y // 400 if a % 7 == 3: count += 1 print(count)