#coding: utf-8 ##yuki_87 def leap(y): if y%400==0: return True if y%100==0: return False if y%4==0: return True return False n=int(raw_input()) x=0 y=2014 count=0 while y<=n: if y+400<=n: y+=400 count+=57 if x==0: count+=1 if leap(y+1)==True: x+=2 elif leap(y+1)==False: x+=1 x%=7 y+=1 print count -1