from Queue import * # Queue, LifoQueue, PriorityQueue from bisect import * #bisect, insort from collections import * #deque, Counter,OrderedDict,defaultdict #set([]) import math import copy import itertools import string import sys import datetime myread = lambda : map(int,raw_input().split()) #2014 / 7 / 23 def naive_cnt(y1,y2): if y2 > 9999: y1,y2 = y1 % 400, (y2-y1) + (y1%400) base = datetime.date(2014,7,23) ret = 0 for l in xrange(y1,y2+1): now = datetime.date(l,7,23) if now.weekday() == base.weekday(): ret += 1 return ret def solver(): N = int(raw_input()) x = (N - 2014) / 400 ans = x * naive_cnt(2014,2014+400-1) ans += naive_cnt(x * 400 + 2014,N) print ans - 1 if __name__ == "__main__": solver()