import sys

import math



N = 1000000

primes = [1] * (N//2+1)

primes[0] = 1



for i in range(3,int(math.sqrt(N))+1,2):

    if primes[i//2]:

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

    primes[i//2] += primes[i//2-1]



for i in range(int(math.sqrt(N))+1,N+1,2):

    primes[i//2] += primes[i//2-1]





for i in sys.stdin:

    n = int(i)

    if n == 1:

        print((0))

    elif n == 2:

        print((1))

    else:

        print((primes[(n-1)//2]))
import sys

  

N = 1000000

primes = [1] * (N//2)

primes[0] = 0

  

for i in range(3,int(N**0.5),2):

    if primes[i//2]:

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

  

for i in sys.stdin:

    n = int(i)

    if n < 3:

        print((n-1))

    else:

        print((sum(primes[:(n+1)//2])+1))
import sys
import math

N = 1000000
primes = [1] * (N // 2 + 1)
primes[0] = 1
for i in range(3, int(math.sqrt(N)) + 1, 2):
    if primes[i // 2]:
        primes[(i * i) // 2 :: i] = [0] * len(primes[(i * i) // 2 :: i])
    primes[i // 2] += primes[i // 2 - 1]
for i in range(int(math.sqrt(N)) + 1, N + 1, 2):
    primes[i // 2] += primes[i // 2 - 1]
for i in sys.stdin:
    n = int(i)
    if n == 1:
        print((0))
    elif n == 2:
        print((1))
    else:
        print((primes[(n - 1) // 2]))

import sys

N = 1000000
primes = [1] * (N // 2)
primes[0] = 0
for i in range(3, int(N**0.5), 2):
    if primes[i // 2]:
        primes[(i * i) // 2 :: i] = [0] * len(primes[(i * i) // 2 :: i])
for i in sys.stdin:
    n = int(i)
    if n < 3:
        print((n - 1))
    else:
        print((sum(primes[: (n + 1) // 2]) + 1))

-import math -primes = [1] * (N // 2 + 1) -primes[0] = 1 -for i in range(3, int(math.sqrt(N)) + 1, 2): +primes = [1] * (N // 2) +primes[0] = 0 +for i in range(3, int(N**0.5), 2): -    primes[i // 2] += primes[i // 2 - 1] -for i in range(int(math.sqrt(N)) + 1, N + 1, 2): -    primes[i // 2] += primes[i // 2 - 1] -    if n == 1: -        print((0)) -    elif n == 2: -        print((1)) +    if n < 3: +        print((n - 1)) -        print((primes[(n - 1) // 2])) +        print((sum(primes[: (n + 1) // 2]) + 1))