CodeEff/ECCO huggingface dataset:
# Original solution
import sys

MAX = 999999

def is_prime(n):
  if n == 2:return True
  if n % 2 == 0:return False
  for i in range(3,int(n**0.5)+1,2):
    if n % i == 0:return False
  return True

def prime_list(n):
  result = []
  if n >= 2:result.append(2)
  for i in range(3,n+1,2):
    if is_prime(i):result.append(i)
  return result

L = prime_list(int(MAX**0.5))

def is_prime_2(n):
  a = int(n ** 0.5)
  for i in L:
    if i > a:return True
    if n % i == 0:return False
  return True

def prime_count(n):
  result = 0
  if n >= 2:result+=1
  for i in range(3,n+1,2):
    if is_prime_2(i):result+=1
  return result

L2 = prime_list(MAX)

def prime_count_2(n):
  for i,v in enumerate(L2):
    if v > n:return i
  return len(L2)

for n in sys.stdin:
  print((prime_count_2(int(n))))

# Optimized solution
import sys
import time

MAX = 999999

def is_prime(n):
  if n == 2:return True
  if n % 2 == 0:return False
  for i in range(3,int(n**0.5)+1,2):
    if n % i == 0:return False
  return True

def prime_list(n):
  return ([2] if n > 1 else []) + [i for i in range(3,n+1,2) if is_prime(i)]

L = prime_list(int(MAX**0.5))

def is_prime_2(n):
  a = int(n ** 0.5)
  for i in L:
    if i > a:return True
    if n % i == 0:return False
  return True

def prime_count(n):
  result = 0
  if n >= 2:result+=1
  for i in range(3,n+1,2):
    if is_prime_2(i):result+=1
  return result

def prime_list2(n):
  return ([2] if n > 1 else []) + [i for i in range(3,n+1,2) if is_prime_2(i)]

L2 = prime_list2(MAX)

def prime_count_2(n):
  for i,v in enumerate(L2):
    if v > n:return i
  return len(L2)

for n in sys.stdin:
  print((prime_count_2(int(n))))
# Original solution
import sys

for line in sys.stdin:
	i = 5
	lis = [2,3]
	while i <= int(line):
		if i % 3 != 0:
			j = 5
			while j <= int(i**0.5):
				if j % 3 != 0:
					if i % j == 0:
						break
				j += 2
			else:
				lis.append(i)
		i += 2
	print(len(lis))

# Optimized solution
import sys
for line in sys.stdin:
	lis = []
	num = int(line)
	if num >= 2:
		lis.append(2)
	if  num >= 3:
		lis.append(3)
	if num >= 5:
		for i in range(5,num+1,2):
			for item in lis:
				if item > (i**0.5):
					lis.append(i)
					break
				if i % item == 0:
					break
			else:
				lis.append(i)
	print(len(lis))
# Original solution
from math import sqrt
def prime(n):
    if n == 2:
        return True
    elif n < 2 or n % 2 == 0:
        return False
    else:
        i = 3
        while i <= sqrt(n):
            if n % i == 0:
                return False
            i += 2
    return True

while True:
    try:
        n = int(eval(input()))
        if n < 2:
            c = 0
        else:
            c = 1
        for i in range(3,n+1,2):
            if prime(i):
                c += 1

        print(c)

    except:
        exit()

# Optimized solution
from math import sqrt
def prime(n):
    if n == 2:
        return True
    elif n < 2 or n % 2 == 0:
        return False
    else:
        i = 1
        while p_list[i] <= sqrt(n):
            if n % p_list[i] == 0:
                return False
            i += 1
    return True
def p_count(n):
    c = 0
    for p in p_list:
        if(p > n):
            break
        c += 1
    return c

p_list = [2,3]
while True:
    try:
        n = int(eval(input()))
        for i in range(p_list[-1]+2,n+1,2):
            if (prime(i)):
                p_list.append(i)
        print((p_count(n)))
    except:
        exit()
# Original solution
import math

r = 999999
sqrt = int(math.sqrt(r))
p = [1 for i in range(r)]
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        for j in range(2*(i+1)-1,r,i+1):
            p[j] = 0

while True:
    try:
        n = int(input())
        print(sum(p[:n]))
    except:
        break

# Optimized solution
import math

r = 999999
sqrt = int(math.sqrt(r))
p = [1 for i in range(r)]
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        for j in range(2*i+1,r,i+1):
            p[j] = 0

while True:
    try:
        n = int(input())
        print(sum(p[:n]))
    except:
        break
# Original solution
import math

r = 999999
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        for j in range(2*i+1,r,i+1):
            p[j] = 0

while True:
    try:
        n = int(input())
        print(p[:n].count(1))
    except:
        break

# Optimized solution
import math

r = 999999
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        for j in range(2*i+1,r,i+1):
            p[j] = 0

while True:
    try:
        n = int(input())
        print(sum(p[:n]))
    except:
        break
# Original solution
import math

r = 999999
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        for j in range(2*i+1,r,i+1):
            p[j] = 0

while True:
    try:
        n = int(input())
        print(sum(p[:n]))
    except:
        break

# Optimized solution
import math
n = []
while True:
    try:
        n.append(int(input()))
    except:
        break

r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        for j in range(2*i+1,r,i+1):
            p[j] = 0

for i in n:
     print(sum(p[:i]))
# Original solution
import math
n = []
while True:
    try:
        n.append(int(input()))
    except:
        break

r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        for j in range(2*i+1,r,i+1):
            p[j] = 0

for i in n:
     print(sum(p[:i]))

# Optimized solution
import math
n = []
while True:
    try:
        n.append(int(input()))
    except:
        break
 
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)]
 
for i in n:
     print(sum(p[:i]))
# Original solution
def isPrime(p):
	if p == 2: return 1
	if p < 2 or p&1 == 0: return 0
	return 1 if pow(2,p-1,p) == 1 else 0

while True:
	try:
		n = int(input())
		print(sum(isPrime(i) for i in range(1,n+1)))
	except:
		break

# Optimized solution
def isPrime(p):
	if p == 2: return 1
	if p < 2 or p&1 == 0: return 0
	return 1 if pow(2,p-1,p) == 1 else 0

while True:
	try:
		n = int(input())
		print(sum(isPrime(i) for i in range(3,n+1,2))+1)
	except:
		break
# Original solution
def isPrime(p):
	if p == 2: return 1
	if p < 2 or p&1 == 0: return 0
	return 1 if pow(2,p-1,p) == 1 else 0

while True:
	try:
		n = int(input())
		print(sum(isPrime(i) for i in range(5,n+1,2))+2)
	except:
		break

# Optimized solution
n  = []
while True:
    try:
        n.append(int(input()))
    except:
        break

R = max(n)+1
p = [1]*R
p[0] = p[1] = 0
i = 2
while i*i <= R:
    if p[i]:
        p[2*i::i] = [0 for x in range(2*i,R,i)]
    i += p[i+1:].index(1)+1
for i in n:
    print(sum(p[:i+1]))
# Original solution
import sys
for line in sys.stdin:
    count = 0
    n = int(line)
    if n>=2: count += 1
    for i in range(3,n+1,2):
        if pow(2,i-1,i)==1: count += 1
    print(count)

# Optimized solution
import sys
for line in sys.stdin:
    n = int(line)
    flag = [True]*(n+1)
    flag[0] = flag[1] = False
    for i in range(2,int(n**0.5)+1):
        if flag[i]:
            for j in range(i**2, n+1, i):
                flag[j] = False
    print((flag.count(True)))
# Original solution
prime=[True]*1000000
np=[0]*1000000
for i in range(2,1000000):
    if prime[i]:
        for j in range(i*2,1000000,i):
            prime[j]=False
    np[i]=np[i-1]+prime[i]

while True:
    try:
        n=int(eval(input()))
    except:
        break
    print((np[n]))

# Optimized solution
prime=[True]*1000000
np=[0]*1000000
for i in range(2,1000):
    if prime[i]:
        for j in range(i*2,1000000,i):
            prime[j]=False

while True:
    try:
        n=int(eval(input()))
    except:
        break
    print((sum(prime[2:n+1])))
# Original solution
prime=[True]*1000000
np=[0]*1000000
for i in range(2,1000):
    if prime[i]:
        for j in range(i*2,1000000,i):
            prime[j]=False

while True:
    try:
        n=int(eval(input()))
    except:
        break
    print((sum(prime[2:n+1])))

# Optimized solution
prime=[True]*1000000
for i in range(2,1000):
    if prime[i]:
        for j in range(i*2,1000000,i):
            prime[j]=False

while True:
    try:
        n=int(eval(input()))
    except:
        break
    print((sum(prime[2:n+1])))
# Original solution
def sieve(n):
    a = [1 for i in range(n + 1)]
    for i in range(2, n + 1):
        if a[i]:
            for j in range(2 * i, n + 1, i):
                a[j] = 0
    return a[2:]

while True:
    try:
        n = int(input())
        print(len([x for x in sieve(n) if x]))
    except (EOFError):
        break

# Optimized solution
def sieve(n):
    a = [1] * (n + 1)
    for i in range(2, n):
        if i * i > n: break
        if a[i]:
            for j in range(2 * i, n + 1, i):
                a[j] = 0
    return a[2:]

while True:
    try:
        n = int(input())
        print(len([x for x in sieve(n) if x]))
    except (EOFError):
        break
# Original solution
import math as m
while True:
	try:
		n=int(eval(input()))
		a=[0]*(n+1)
		a[0],a[1]=1,1
		for i in range(2,int(m.sqrt(n))+1):
			for j in range(2,int(n/i)+1):
				a[i*j]=1
		print((a.count(0)))
	except:
		break

# Optimized solution
while True:
	try:
		n=int(eval(input()))
		a=[True]*(n+1)
		a[0]=a[1]=False
		for i in range(2,int(n**0.5)+1):
			if a[i]:
				for j in range(i**2,n+1,i):
					a[j]=False
		print((a.count(True)))
	except:
		break
# Original solution
from bisect import bisect

n = 10000000
sn = int(n**0.5)+1

num = [False, False] + [True]*(n-1)
for i in range(2, int(n**0.5)+1):
  if num[i]:
    for j in range(i**2, n, i):
      num[j] = False
prime = [i for i in range(2, n) if num[i]]

while True:
  try:
    print(bisect(prime, eval(input())))
  except:
    break

# Optimized solution
from bisect import bisect

n = 1000000
sn = int(n**0.5)+1

num = [False, False] + [True]*(n-1)
for i in range(2, int(n**0.5)+1):
  if num[i]:
    for j in range(i**2, n, i):
      num[j] = False
prime = [i for i in range(2, n) if num[i]]

while True:
  try:
    print(bisect(prime, eval(input())))
  except:
    break
# Original solution
import sys
import math as mas

def sieve(n):
	p=[True for i in range(n+1)]
	p[0]=p[1]=False
	end=int(n**0.5)
	for i in range(2,end+1):
		if p[i]:
			for j in range(i*i,n+1,i):
				p[j]=False
	return p
	
sosu=sieve(1000010)
for i in sys.stdin:
	print((sum(sosu[t] for t in range(int(i)+1))))

#	a,b=map(int,i.split())
#	print(gcd(a,b),lcm(a,b))

# Optimized solution
import sys
import math as mas

def sieve(n):
	p=[True for i in range(n+1)]
	p[0]=p[1]=False
	end=int(n**0.5)
	for i in range(2,end+1):
		if p[i]:
			for j in range(i*i,n+1,i):
				p[j]=False
	return p
	
sosu=sieve(1000010)
for i in sys.stdin:
	t=int(i)
	if t<2:print((0))
	elif t==2:print((1))
	else:print((1+sum(sosu[t] for t in range(3,int(i)+1,2))))

#	a,b=map(int,i.split())
#	print(gcd(a,b),lcm(a,b))
# Original solution
import sys
 
 
xx = 500000
f = [0, 1] * xx
 
i = 3
while i * i <= 2 * xx:
    if f[i] == 1:
        j = i * i
        while j <= 2 * xx:
            f[j] = 0
            j += i + i
    i += 2
 
f.pop(0)
f.pop(1)
 
for n in sys.stdin:
    i = int(n)
    if i < 2:
        print((0))
    else:
        print((sum(f[:i - 1])))

# Optimized solution
import sys
 
 
f = [0, 1] * 500000
 
i = 3
while i <= 1000:
    if f[i] == 1:
        j = i * i
        while j <= 1000000:
            f[j] = 0
            j += i + i
    i += 2
 
f.pop(0)
f.pop(1)
 
for n in sys.stdin:
    i = int(n)
    if i < 2:
        print((0))
    else:
        print((sum(f[:i - 1])))
# Original solution
import sys
  
f = [0, 1] * 500000
f.append(0)
f[1] = 0
f[2] = 1
i = 3
while i < 1000:
    if f[i] == 1:
        j = i * i
        while j <= 1000000:
            f[j] = 0
            j += i + i
    i += 2

for n in sys.stdin:
    i = int(n)
    print((sum(f[:i + 1])))

# Optimized solution
import sys

f = [1, 0, 0, 0, 1, 0] * (1000000 // 6 + 1)
f = [0, 0, 1, 1] + f[3:-2]

i = 5
while i < 1000:
    if f[i] == 1:
        j = i * i
        while j <= 1000000:
            f[j] = 0
            j += i + i
    i += 2

for n in sys.stdin:
    i = int(n)
    print((sum(f[:i + 1])))
# Original solution
def mk_table(n):
    res = [1] * (n + 1)
    res[:2] = [0, 0]

    for i in range(2, n):
        if i ** 2 > n:
            break

        if res[i] == 1:
            j = 2
            while i * j <= n:
                res[i * j] = 0
                j += 1

    return res


tbl = mk_table(999999)
try:
    while 1:
        print((len([x for x in tbl[:int(eval(input()))+1] if x == 1])))
except Exception:
    pass

# Optimized solution
def mk_table(n):
    res = [1] * (n + 1)
    res[:2] = 0, 0

    for i in range(2, n):
        if i ** 2 > n:
            break

        if res[i] == 1:
            for j in range(i*2, n + 1, i):
                res[j] = 0

    return res


tbl = mk_table(999999)
try:
    while 1:
        print((len([x for x in tbl[:int(eval(input()))+1] if x == 1])))
except Exception:
    pass
# Original solution
import sys


def count_prime(n):
    global count, pool
    if not pool:
        return count
    p = pool[0]
    while p <= n:
        pool = tuple(i for i in pool if i % pool[0])
        count += 1
        if not pool:
            break
        p = pool[0]
    return count


inset = list(map(int, sys.stdin))
max_in = max(inset)
pool, count = tuple(range(3, max_in + 1, 2)), 1 if max_in > 1 else 0
inset = [(n, i) for i, n in enumerate(inset)]
inset.sort()
outset = [(t[1], count_prime(t[0])) for t in inset]
outset.sort()

print(('\n'.join(map(str, [t[1] for t in outset]))))

# Optimized solution
import sys

input_list = list(int(i) for i in sys.stdin)
max_n = min(1000000, max(input_list) + 1)

prime_list = list(i % 2 for i in range(max_n))
prime_list[1], prime_list[2] = 0, 1
i = 3
while i * i < max_n:
    if prime_list[i]:
        for j in range(i * 2, max_n, i):
            prime_list[j] = 0
    i += 2

for i in range(1, max_n):
    prime_list[i] += prime_list[i - 1]

inset = sorted((n, i) for i, n in enumerate(input_list))
outset = sorted((t[1], prime_list[t[0]]) for t in inset)
for t in outset:
    print((t[1]))
# Original solution
# coding: utf-8

LIMIT = 999999

prime = [0, 1] + [0 if i % 2 == 0 else 1 for i in range(3, LIMIT + 1)]

for i in range(3, LIMIT + 1):
    if prime[i - 1]:
        for j in range(i ** 2, LIMIT + 1, i):
            prime[j - 1] = 0

while True:
    try:
        n = int(eval(input()))
    except EOFError:
        break

    print((sum(prime[:n])))



# Optimized solution
# coding: utf-8

LIMIT = 999999

prime = [0, 1] + [0 if i % 2 == 0 else 1 for i in range(3, LIMIT + 1)]

for i in range(3, int(LIMIT ** 0.5) + 1):
    if prime[i - 1]:
        for j in range(i ** 2, LIMIT + 1, i):
            prime[j - 1] = 0

while True:
    try:
        n = int(eval(input()))
    except EOFError:
        break

    print((sum(prime[:n])))
# Original solution
import sys
def fact(n):
    ret = [1]
    if n%2==0:
        ret.append(2)
        return ret
    for i in range(3,int(n**0.5)+1,2):
        if n%i==0:
            ret.append(i)
            return ret
    return ret
def isPrime(n):
    if n<=1:
        return False
    if n==2:
        return True
    if fact(n)==[1]:
        return True
    else:
        return False
lines = sys.stdin.readlines()
for line in lines:
    inp = int(line)
    s=0
    for i in range(2,inp+1):
        if isPrime(i):
            s+=1
    print (s)

# Optimized solution
import sys
results = {}
def fact(n):
    if n in results:
        return results[n]
    ret = [1]
    if n%2==0:
        ret.append(2)
        results[n]=ret
        return ret
    for i in range(3,int(n**0.5)+1,2):
        if n%i==0:
            ret.append(i)
            results[n]=ret
            return ret
    results[n]=ret
    return ret
def isPrime(n):
    if n<=1:
        return False
    if n==2:
        return True
    if fact(n)==[1]:
        return True
    else:
        return False
lines = sys.stdin.readlines()
for line in lines:
    inp = int(line)
    s=0
    for i in range(2,inp+1):
        if isPrime(i):
            s+=1
    print (s)
# Original solution
import sys
results = {}
def fact(n):
    if n in results:
        return results[n]
    ret = [1]
    if n%2==0:
        ret.append(2)
        results[n]=ret
        return ret
    for i in range(3,int(n**0.5)+1,2):
        if n%i==0:
            ret.append(i)
            results[n]=ret
            return ret
    results[n]=ret
    return ret
def isPrime(n):
    if n<=1:
        return False
    if n==2:
        return True
    if fact(n)==[1]:
        return True
    else:
        return False
lines = sys.stdin.readlines()
for line in lines:
    inp = int(line)
    s=0
    for i in range(2,inp+1):
        if isPrime(i):
            s+=1
    print (s)

# Optimized solution
import sys
results = {}
def fact(n):
    if n in results:
        return results[n]
    ret = [1]
    if n%2==0:
        ret.append(2)
        results[n]=ret
        return ret
    for i in range(3,int(n**0.5)+1,2):
        if n%i==0:
            ret.append(i)
            results[n]=ret
            return ret
    results[n]=ret
    return ret
prime_results = {}
def isPrime(n):
    if n in prime_results:
        return prime_results[n]
    if n<=1:
        return False
    if n==2:
        return True
    if fact(n)==[1]:
        prime_results[n]=True
        return True
    else:
        prime_results[n]=False
        return False
lines = sys.stdin.readlines()
for line in lines:
    inp = int(line)
    s=0
    for i in range(2,inp+1):
        if isPrime(i):
            s+=1
    print (s)
# Original solution
# AOJ 0009 Prime Number
# Python3 2018.6.9 bal4u

MAX = 1000000
SQRT = 1000     # sqrt(MAX)

prime = [True for i in range(MAX)]
def sieve():
	for i in range(2, MAX, 2):
		prime[i] = False
	for i in range(3, SQRT, 2):
		if prime[i] is True:
			for j in range(i*i, MAX, i):
				prime[j] = False

sieve()
cnt = [0 for i in range(MAX+1)]
cnt[2] = 1
f = 1
for i in range(3, MAX, 2):
	if prime[i] is True:
		f += 1;
	cnt[i] = f
	cnt[i+1] = f
	
while True:
    try:
        print((cnt[int(eval(input()))]))
    except EOFError:
        break


# Optimized solution
# AOJ 0009 Prime Number
# Python3 2018.6.9 bal4u

MAX = 1000000
SQRT = 1000     # sqrt(MAX)

prime = [0] * MAX

def sieve():
	for i in range(3, MAX, 2):
		prime[i] = 1
	for i in range(3, SQRT, 2):
		if prime[i] == 1:
			for j in range(i*i, MAX, i):
				prime[j] = 0

sieve()
cnt = [0] * (MAX+1)
cnt[2] = f = 1
for i in range(3, MAX, 2):
	if prime[i]:
		f += 1;
	cnt[i] = cnt[i+1] = f
	
while True:
    try:
        print((cnt[int(eval(input()))]))
    except EOFError:
        break
# Original solution
import math
def get_primes(goal):
	n_list = list(range(3,goal+1,2))
	primes = [2]
	sieve = [[n,1] for n in n_list]#Sieve of Eratosthenes
	while sieve[0][0] < math.sqrt(goal+1):
		target = sieve[0][0]
		primes = primes + [target]
		i = 0
		while i < len(sieve):
			sieve[i][1] = 0
			i += target
		while  sieve[0][1] == 0:
			sieve = sieve[1:]
	primes = primes + [x[0] for x in [n for n in sieve if n[1]]]
	return primes

def bin_search_count(list,cond):
	if cond(list[0]) and cond(list[-1]):
		return len(list)
	if cond(list[0]) == False and cond(list[-1]) == False:
		return 0
	
	Imin = 0
	Imax = len(list) - 1
	Imid = int(Imin * 0.5 + Imax * 0.5)
	return bin_search_count(list[:Imid + 1],cond) + bin_search_count(list[Imid + 1:],cond)

primes = get_primes(1000000)
while 2>1:
	
	try:
		n = int(input())
		print(bin_search_count(primes,lambda x:x <= n))
	except EOFError:
		break
	except ValueError:
		break

# Optimized solution
import math
def bin_search_count(list,cond):
	if cond(list[0]) and cond(list[-1]):
		return len(list)
	if cond(list[0]) == False and cond(list[-1]) == False:
		return 0
	Imin = 0
	Imax = len(list) - 1
	Imid = int(Imin * 0.5 + Imax * 0.5)
	return bin_search_count(list[:Imid + 1],cond) + bin_search_count(list[Imid + 1:],cond)
	
def get_primes(goal):
	primes = [2,3]
	prime_index = 1
	goalrt = math.sqrt(goal+1)
	sieve = [[n,1] for n in range(5,goal+1,2)]#Sieve of Eratosthenes
	while primes[prime_index] < goalrt:
		target = primes[prime_index]
		targetsq = target ** 2
		part_index = bin_search_count(sieve,lambda n: n[0] < targetsq)
		primes = primes + [nd[0] for nd in [n for n in sieve[:part_index] if n[1] == 1]]
		sieve = sieve[part_index:]
		i = 0
		while i < len(sieve):
			sieve[i][1] = 0
			i += target
		prime_index += 1
	primes = primes + [nd[0] for nd in [n for n in sieve if n[1]]]
	return primes

primes = get_primes(1000000)
while 2>1:
	
	try:
		n = int(input())
		print(bin_search_count(primes,lambda x:x <= n))
	except EOFError:
		break
	except ValueError:
		break
# Original solution
while True:
  t = []
  b = 0
  try:
    a = int(eval(input()))
    for n in range(2,10000):
      for x in range(2,n):
        if n % x == 0:
          break
      else:
        t.append(n)

    for b in range(1000):
      if t[b] > a:
        print(len(t[0:b]))
        break
  except EOFError:
    break

# Optimized solution

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env python
import sys
 
list=1000000*[1]
 
list[0] = 0
list[1] = 0
for i in range(1,1000000):
    if list[i] == 1:
        for j in range(i*i,1000000,i):
            list[j] = 0
 
for i in range(2,1000000):
    list[i] += list[i-1]
     
for line in sys.stdin:
    a = int(line)
    print(list[a])
# Original solution
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)

# Optimized solution
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)
# Original solution
def Eratosthenes(n):
	N = [1 for i in range(0,n+1)]
	i = 3
	while i*i<=n:
		if N[i]:
			j = i*3
			while j<=n:
				N[j] = 0
				j += i*2
		i += 2
	return N

while True:
	N = Eratosthenes(999999)
	try:
		n = int(eval(input()))
	except EOFError:
		break
	cnt = 0
	if n>=2:
		cnt = 1
	for i in range(3, n+1, 2):
		cnt += N[i]
	print(cnt)

# Optimized solution

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
def sieve(n):
    p = [True for i in range(n + 1)]
    p[0] = p[1] = False
    end = int(n ** .5)
    for i in range(2, end + 1):
        if p[i]:
            for j in range(i * i, n + 1, i):
                p[j] = False
 
    return p
 
def primes_below(n):
    if n < 2: return 0
    c = 1
    for i in range(3, n + 1, 2):
        if p[i]: c += 1
 
    return c
 
p = sieve(1000000)
while 1:
    try:
        n = int(eval(input()))
    except EOFError:
        break
    else:
        print((primes_below(n)))
# Original solution
def Eratosthenes(n):
	N = [1 for i in range(0,n+1)]
	i = 3
	while i*i<=n:
		if N[i]:
			j = i*i
			while j<=n:
				N[j] = 0
				j += i*2
		i += 2
	return N

while True:
	N = Eratosthenes(999999)
	try:
		n = int(eval(input()))
	except EOFError:
		break
	cnt = 0
	if n>=2:
		cnt = 1
	for i in range(3, n+1, 2):
		cnt += N[i]
	print(cnt)

# Optimized solution
def Eratosthenes(n):
	N = [1 for i in range(0,n+1)]
	i = 3
	while i*i<=n:
		if N[i]:
			j = i*i
			while j<=n:
				N[j] = 0
				j += i*2
		i += 2
	return N

N = Eratosthenes(999999)
while True:
	try:
		n = int(eval(input()))
	except EOFError:
		break
	cnt = 0
	if n>=2:
		cnt = 1
	for i in range(3, n+1, 2):
		cnt += N[i]
	print(cnt)