import sys

import math

M = 1000000

B = int(math.sqrt(M)+1)

N = M//6

N1 = N+1 if M % 6 == 5 else N

N2 = N+1 if M % 6 >= 1 else N

l = [1] * N1

m = [1] * N2

for i in range(5,B,6):

    p = (i-5)//6

    ini = (i*5-1)//6

    if l[p] == 1:

        l[p+i::i] = [0] * len(l[p+i::i])

        m[ini-1::i] = [0] * len(m[ini-1::i])

    if m[p] == 1:

        m[p+i+2::i+2] = [0] * len(m[p+i+2::i+2])

        l[ini+1::i+2] = [0] * len(l[ini+1::i+2])

for i in sys.stdin:

    n = int(i)

    r =  n-1 if n < 3 else sum(l[0:(n+1)//6])+sum(m[0:(n-1)//6])+2

    print(r)
import sys

import math

M = 1000000

B = int(math.sqrt(M)+1)//6+1

N = M//6

N1 = N+1 if M % 6 == 5 else N

N2 = N+1 if M % 6 >= 1 else N

l = [1] * N1

m = [1] * N2

i = 5

ini = 4

for p in range(B):

    if l[p] == 1:

        l[p+i::i] = [0] * len(l[p+i::i])

        m[ini-1::i] = [0] * len(m[ini-1::i])

    if m[p] == 1:

        m[p+i+2::i+2] = [0] * len(m[p+i+2::i+2])

        l[ini+1::i+2] = [0] * len(l[ini+1::i+2])

    i += 6

    ini += 5



for i in sys.stdin:

    n = int(i)

    r =  n-1 if n < 3 else sum(l[0:(n+1)//6])+sum(m[0:(n-1)//6])+2

    print(r)
import sys
import math

M = 1000000
B = int(math.sqrt(M) + 1)
N = M // 6
N1 = N + 1 if M % 6 == 5 else N
N2 = N + 1 if M % 6 >= 1 else N
l = [1] * N1
m = [1] * N2
for i in range(5, B, 6):
    p = (i - 5) // 6
    ini = (i * 5 - 1) // 6
    if l[p] == 1:
        l[p + i :: i] = [0] * len(l[p + i :: i])
        m[ini - 1 :: i] = [0] * len(m[ini - 1 :: i])
    if m[p] == 1:
        m[p + i + 2 :: i + 2] = [0] * len(m[p + i + 2 :: i + 2])
        l[ini + 1 :: i + 2] = [0] * len(l[ini + 1 :: i + 2])
for i in sys.stdin:
    n = int(i)
    r = n - 1 if n < 3 else sum(l[0 : (n + 1) // 6]) + sum(m[0 : (n - 1) // 6]) + 2
    print(r)

import sys
import math

M = 1000000
B = int(math.sqrt(M) + 1) // 6 + 1
N = M // 6
N1 = N + 1 if M % 6 == 5 else N
N2 = N + 1 if M % 6 >= 1 else N
l = [1] * N1
m = [1] * N2
i = 5
ini = 4
for p in range(B):
    if l[p] == 1:
        l[p + i :: i] = [0] * len(l[p + i :: i])
        m[ini - 1 :: i] = [0] * len(m[ini - 1 :: i])
    if m[p] == 1:
        m[p + i + 2 :: i + 2] = [0] * len(m[p + i + 2 :: i + 2])
        l[ini + 1 :: i + 2] = [0] * len(l[ini + 1 :: i + 2])
    i += 6
    ini += 5
for i in sys.stdin:
    n = int(i)
    r = n - 1 if n < 3 else sum(l[0 : (n + 1) // 6]) + sum(m[0 : (n - 1) // 6]) + 2
    print(r)

-B = int(math.sqrt(M) + 1) +B = int(math.sqrt(M) + 1) // 6 + 1 -for i in range(5, B, 6): -    p = (i - 5) // 6 -    ini = (i * 5 - 1) // 6 +i = 5 +ini = 4 +for p in range(B): +    i += 6 +    ini += 5