#K85042. Counting Distinct Prime Factors of Factorials

    ID: 36553 Type: Default 1000ms 256MiB

Counting Distinct Prime Factors of Factorials

Counting Distinct Prime Factors of Factorials

Given a non-negative integer \( n \), your task is to compute the number of distinct prime factors of \( n! \) (i.e. the factorial of \( n \)).

Explanation: Since \( n! = 1 \times 2 \times 3 \times \cdots \times n \), every prime number less than or equal to \( n \) divides \( n! \). Therefore, the problem reduces to counting the number of prime numbers \( p \) such that \( p \le n \).

You can use the Sieve of Eratosthenes algorithm to efficiently count the prime numbers up to \( n \).

inputFormat

The input is read from standard input and consists of a single line containing an integer \( n \) (with \( n \ge 0 \)).

outputFormat

Output the number of distinct prime factors of \( n! \) to standard output.

## sample
5
3

</p>