import java.util.Scanner; public class Yukicoder87 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long N = sc.nextLong() - 2014; long res = 57 * (N / 400); N = N % 400; // ツェラーの公式 for (long i = 2015; i <= N + 2015; i++) if ((23 + (int) (26 * 8 / 10) + (i % 100) + (long) ((i % 100) / 4) + 5 * (long) (i / 100) + (long) (i / 100) / 4) % 7 == 4) res++; System.out.println(res); } }