Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/sonlar-eratosfen-galviri

Sieve of Eratosthenes

Easy 1000 ms 128 MB 29%
Share

You are given a positive integer $n$. Find how many primes there are among the numbers from $1$ to $n$.

The numbers from one to n in a row, the primes highlighted

Input

One positive integer $n$.

Output

One integer — the number of primes from $1$ to $n$.

Note

$1 \le n \le 5 * 10^{6}$

Examples

Input #1
10
Output #1
4
Input #2
20
Output #2
8

Sign in to submit a solution

Signing up is free and takes a minute.