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