package no87; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong() - 2014; int[] count = new int[400]; count[0] = 1; int youbi = 0; for(int i=1;i<400;i++) { youbi = (youbi + (isUruu(2014+ i) ? 366 : 365)) % 7; count[i] = count[i-1] + (youbi == 0 ? 1 : 0); } long ans = 0; ans += (n / 400) * count[399]; n %= 400; ans += count[(int) n%400]; System.out.println(ans-1); } public static boolean isUruu(long y) { if (y%400 == 0) { return true; }else if(y%100 == 0) { return false; }else{ return y%4 == 0; } } }