# -*- coding: utf-8 -*- # メモ # TLE解 from collections import Counter def solve(N, start): year = 1 day = 0 count = Counter() for i in xrange(7): count[i] = 0 while year <= N: if year % 400 == 0: day += 366 elif year % 100 == 0: day += 365 elif year % 4 == 0: day += 366 else: day += 365 if year > start: count[day % 7] += 1 year += 1 return count if __name__ == '__main__': N = int(raw_input()) c = solve(N, 2014) print c[3]