Count divisors

Write codeMedium18 min

Your task

Given a positive integer n (1 <= n <= 10^12), return the number of positive divisors of n, including 1 and n itself. For example, 12 has divisors 1, 2, 3, 4, 6, 12, so the answer is 6. The value of n can be large enough that listing every candidate up to n is too slow.

Examples

count_divisors(n: int) -> int
Example 1
Inputcount_divisors(12)
Output6