Description

Given an integer n, return the number of prime numbers that are strictly less than n. A prime number is greater than 1 and has no divisors other than 1 and itself.

Examples

Input:n = 10
Output:4
Explanation:

There are 4 prime numbers less than 10: 2, 3, 5, 7.

Input:n = 0
Output:0
Explanation:

No primes less than 0.

Input:n = 1
Output:0
Explanation:

No primes less than 1.

Constraints

  • 0 ≤ n ≤ 5 × 10⁶

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!