from bisect import bisect N = int(input()) nowy = 2015 dnow = 1 X = [] tmp = 0 while not((nowy - 2014) % 400 == 0 and dnow == 0): nowy += 1 dnow += 1 if nowy % 400 == 0: dnow += 1 elif nowy % 100 == 0: dum = 0 elif nowy % 4 == 0: dnow += 1 if dnow > 6: dnow -= 7 if dnow == 0: X.append(nowy - 2014) ans = (N-2014) // 400 * 57 ans += bisect(X,(N - 2014) % 400) print(ans)