def get(num):
    n=0
    is_prime=[0]*200050
    for i in range(0,num+1):
        is_prime[i]=True
    is_prime[0]=is_prime[1]=False
    for i in range(2,num+1):
        if(is_prime[i]):
            n+=1
            for j in range(2*i,num+1,i):
                is_prime[j]=False
    return n

while True:
    a=map(int,raw_input().strip().split())
    b=a[0]
    if(b==0):
        break
    p=get(2*b)-get(b)

#        p=0
#        for i in range(b+1,2*b+1):
#            if(judge(i)):
#                p+=1
    print(p)

