Skip to content
UPEEC

Count the Primes

Medium#math#primes#sieve· solved by 0 · time limit 2.0 s

Count how many prime numbers are ≤n\le n.

Trial division for every number is too slow for big nn — look up the Sieve of Eratosthenes.

Input

A single integer nn.

Output

The number of primes ≤n\le n.

Constraints

1≤n≤5×1061 \le n \le 5 \times 10^6

Sample 1

Input

10

Output

4

Sample 2

Input

1

Output

0

Sign in or join free to run and submit your solution.