import sys

m=166666;s=[1]*m;t=[1]*m

for i in range(m):

 for j in range(2):

  if (s[i],t[i])[j]:

   k=6*i+[5,7][j];n=[i+k,k-i-2]

   s[n[j]::k]=[0]*len(s[n[j]::k])

   t[n[1-j]::k]=[0]*len(t[n[1-j]::k])

for e in map(int,sys.stdin):

 print(([e-1,sum(s[:(e+1)//6])+sum(t[:(e-1)//6])+2][e>3]))

import sys

a=[1]*500000

for i in range(3,999,2):

 if a[i//2]:a[(i*i)//2::i]=[0]*len(a[(i*i)//2::i])

for e in map(int,sys.stdin):print(([e-1,sum(a[:(e+1)//2])][e>3]))

import sys

m = 166666
s = [1] * m
t = [1] * m
for i in range(m):
    for j in range(2):
        if (s[i], t[i])[j]:
            k = 6 * i + [5, 7][j]
            n = [i + k, k - i - 2]
            s[n[j] :: k] = [0] * len(s[n[j] :: k])
            t[n[1 - j] :: k] = [0] * len(t[n[1 - j] :: k])
for e in map(int, sys.stdin):
    print(([e - 1, sum(s[: (e + 1) // 6]) + sum(t[: (e - 1) // 6]) + 2][e > 3]))

import sys

a = [1] * 500000
for i in range(3, 999, 2):
    if a[i // 2]:
        a[(i * i) // 2 :: i] = [0] * len(a[(i * i) // 2 :: i])
for e in map(int, sys.stdin):
    print(([e - 1, sum(a[: (e + 1) // 2])][e > 3]))

-m = 166666 -s = [1] * m -t = [1] * m -for i in range(m): -    for j in range(2): -        if (s[i], t[i])[j]: -            k = 6 * i + [5, 7][j] -            n = [i + k, k - i - 2] -            s[n[j] :: k] = [0] * len(s[n[j] :: k]) -            t[n[1 - j] :: k] = [0] * len(t[n[1 - j] :: k]) +a = [1] * 500000 +for i in range(3, 999, 2): +    if a[i // 2]: +        a[(i * i) // 2 :: i] = [0] * len(a[(i * i) // 2 :: i]) -    print(([e - 1, sum(s[: (e + 1) // 6]) + sum(t[: (e - 1) // 6]) + 2][e > 3])) +    print(([e - 1, sum(a[: (e + 1) // 2])][e > 3]))