import datetime import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def main(): # 2014年7月23日(水) n = int(input()) cnt2014 = [6] * 15 + [5] * 385 p, r = divmod(n, 400) cntn = [p + 1] * (r + 1) + [p] * (399 - r) ans = 0 for i,[c0,c1] in enumerate(zip(cnt2014,cntn)): d = datetime.date(2000 + i, 7, 23) ans += (d.weekday() == 2)*(c1-c0) print(ans) main()