import java.util.*; public class Main { static boolean isLeapYear(long y) { return y % 4 == 0 && (y % 100 != 0 || y % 400 == 0); } static long func(long n) { long cnt1 = 0; long LOOP = 400 * 7; long d = 0; for(int i = 1; i <= LOOP && 2014 + i <= n; i++) { d += isLeapYear(i + 2014) ? 2 : 1; if(d % 7 == 0) cnt1++; if(2014 + i == n) { return cnt1; } } long ans = (n - 2015) / LOOP * cnt1; d = d % 7 * (n - 2015) / LOOP % 7; for(long i = (n - 2015) / LOOP * LOOP + 2015; i <= n; i++) { d += isLeapYear(i) ? 2 : 1; if(d % 7 == 0) ans++; } return ans; } public static void main(String[] args) { /* for(int i = 2015; i <= 10000; i++) { int ans = 0; int d = 0; for(int j = 2015; j <= i; j++) { d += isLeapYear(j) ? 2 : 1; if(d % 7 == 0) ans++; } if(ans != func(i)) { System.err.println(i + " " + ans + " " + func(i)); } } if(true) return; */ try(final Scanner sc = new Scanner(System.in)) { System.out.println(func(sc.nextLong())); } } }