All tasks
Mediummathsievearrays

Count Primes

Time limit 2 s · Memory 64 MB

Statement

You are given an integer n. Print how many prime numbers lie between 1 and n inclusive.

Constraints

1 ≤ n ≤ 10^6

Examples

Input 1
10
Output 1
4
Input 2
1
Output 2
0
Solve this task to unlock the editorial.

AI tutor

Stuck? Get a nudge — the tutor explains the idea, it never hands you the solution.