num = int(input())
def solution(n):
num = set(range(n+1, 2*n+1))
count = 0
for i in range(n, 2*n+1):
if i == 1:
continue
is_prime = True
for j in range(2,i):
if i % j == 0:
is_prime =False
break
if is_prime:
count += 1
return count
while num != 0:
print(solution(num))
num = int(input())
solution(num)