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
]); }
}
new A().run();
}
}
aW1wb3J0IGphdmEudXRpbC4qOwoKY2xhc3MgQSB7CglzdGF0aWMgZmluYWwgYm9vbGVhbltdIGNvbXBvc2l0ZSA9IG5ldyBib29sZWFuWzEyMzQ1NyAqIDJdOwoJc3RhdGljIGZpbmFsIGludFtdIGNudCA9IG5ldyBpbnRbMTIzNDU3ICogMl07CgoJc3RhdGljIHsKCQlmb3IgKGludCBpID0gMjsgaSAqIGkgPCBjb21wb3NpdGUubGVuZ3RoOyBpKyspCgkJCWlmICghY29tcG9zaXRlW2ldKSB7CgkJCQlmb3IgKGludCBqID0gaSAqIGk7IGogPCBjb21wb3NpdGUubGVuZ3RoOyBqICs9IGkpCgkJCQkJY29tcG9zaXRlW2pdID0gdHJ1ZTsKCQkJfQoJCWZvciAoaW50IGkgPSAyOyBpIDwgY250Lmxlbmd0aDsgaSsrKQoJCQlpZiAoY29tcG9zaXRlW2ldKQoJCQkJY250W2ldID0gY250W2kgLSAxXTsKCQkJZWxzZQoJCQkJY250W2ldID0gY250W2kgLSAxXSArIDE7Cgl9CgoJcHVibGljIHZvaWQgcnVuKCkgewoJCVNjYW5uZXIgc2MgPSBuZXcgU2Nhbm5lcihTeXN0ZW0uaW4pOwoJCWZvciAoaW50IG4gPSBzYy5uZXh0SW50KCk7IG4gPiAwOyBuID0gc2MubmV4dEludCgpKSB7CgkJCVN5c3RlbS5vdXQucHJpbnRsbihjbnRbMiAqIG5dIC0gY250W25dKTsKCQl9Cgl9CgoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncykgdGhyb3dzIEV4Y2VwdGlvbiB7CgkJbmV3IEEoKS5ydW4oKTsKCX0KfQ==