import java.util.*; import static java.lang.Math.*; public class ppp { public static void main(String[] args) { Scanner sc=new Scanner(System.in); long n=sc.nextInt()-2014; long amari=n-(n/400)*400; long ans=57*((n-2014)/400); for(int i=2015;i<=2014+amari;i++){ Calendar c = new GregorianCalendar(i, 7-1, 23); if(c.get(Calendar.DAY_OF_WEEK)==4)ans++; } System.out.println(ans); }}