import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); int[] counts = new int[401]; int mod = 365 % 7; for (int i = 0; i < 400; i++) { if (mod == 0) { counts[i]++; } int year = i + 2015; if (year % 4 != 0 && year % 100 == 0) { mod += 365; } else { mod += 366; } mod %= 7; } for (int i = 1; i < 400; i++) { counts[i] += counts[i - 1]; } long times = (n - 2015) / 400; int idx = (int)(n - 2015) % 400; long ans = times * counts[399] + counts[idx]; System.out.println(ans); } }