LogiQuest

23. Count Primes

MediumSieve of Eratosthenes

Print how many prime numbers are less than or equal to n.

Input format

A single integer n.

Output format

The count of primes ≤ n.

Example 1

Input

10

Output

4

Example 2

Input

0

Output

0

Constraints

0 ≤ n ≤ 2 × 10⁶

Read input from standard input and print the answer to standard output. Your code is judged against 6 test cases, most of them hidden.

Loading the MyLoginn IDE…