import java.util.Scanner; public class Main_yukicoder87 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); int ret = 0; long tmp = 0; for (long i = 2015; i <= Math.min(2400, n); i++) { if ((i % 4 == 0 && i % 100 != 0) || (i % 4 == 0 && i % 400 == 0)) { tmp += 2; } else { tmp += 1; } if (tmp % 7 == 0) { ret++; } } if (n > 2400) { int[] wed = new int[400 + 1]; for (long i = 2401; i <= 2800; i++) { if ((i % 4 == 0 && i % 100 != 0) || (i % 4 == 0 && i % 400 == 0)) { tmp += 2; } else { tmp += 1; } if (tmp % 7 == 0) { wed[(int)(i - 2400)] = wed[(int)(i - 1 - 2400)] + 1; } else { wed[(int)(i - 2400)] = wed[(int)(i - 1 - 2400)]; } } ret += (n - 2400) / 400 * wed[400] + wed[(int)((n - 2400) % 400)]; } System.out.println(ret); sc.close(); } }