def f(n): now = 0 cnt = 0 for i in range(2015, 2015 + n): if i % 400 == 0: now += 366 % 7 elif i % 100 == 0: now += 365 % 7 elif i % 4 == 0: now += 366 % 7 else: now += 365 % 7 now %= 7 cnt += int(now == 0) return cnt N = int(input()) N -= 2014 print(f(2800) * (N // 2800) + f(N % 2800))