import datetime date = datetime.date(2014, 7, 23) w = date.weekday() n = int(input()) z = 0 for y in range(2015, 2415): date = datetime.date(y, 7, 23) if date.weekday() == w: z += 1 ans = (n - 2015) // 400 * z n = (n - 2015) % 400 + 2015 for y in range(2015, n + 1): date = datetime.date(y, 7, 23) if date.weekday() == w: ans += 1 print(ans)