def solve(year): q, r = divmod(year-2000, 400) return q * count400(399) + count400(r) - 3 def count400(year): ''' 水曜日を0 木曜日を1 金曜日を2 ... 火曜日を6 であらわすとする。 400年単位で切りが良いので、2000年から数え始めることにする。 2014 0 2013 6 2012 5 2011 3 2010 2 2009 1 2008 0 2007 5 2006 4 2005 3 2004 2 2003 0 2002 6 2001 5 2000 4 ''' weekday = 4 count = 0 for n in range(1, year + 1): weekday += 1 + is_leap_year(n) weekday %= 7 if weekday == 0: count += 1 return count def is_leap_year(n): if n % 400 == 0: return True if n % 100 == 0: return False if n % 4 == 0: return True return False year = int(input()) print(solve(year))