import java.util.*;

class A {
	static final boolean[] composite = new boolean[123457 * 2];
	static final int[] cnt = new int[123457 * 2];

	static {
		for (int i = 2; i * i < composite.length; i++)
			if (!composite[i]) {
				for (int j = i * i; j < composite.length; j += i)
					composite[j] = true;
			}
		for (int i = 2; i < cnt.length; i++)
			if (composite[i])
				cnt[i] = cnt[i - 1];
			else
				cnt[i] = cnt[i - 1] + 1;
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		for (int n = sc.nextInt(); n > 0; n = sc.nextInt()) {
			System.out.println(cnt[2 * n] - cnt[n]);
		}
	}

	public static void main(String[] args) throws Exception {
		new A().run();
	}
}