Python Count Factors
def count_factors(n: int) -> int:
    count = 0
    i = 1
    while i * i < n:
        if n % i == 0:
            count += 2
        i += 1
    if i * i == n:
        count += 1

    return count

This checks divisors in pairs up to the square root, which keeps the work much smaller than testing every number.