You are given a positive integer n. Your task is to return the number of distinct prime factors of n. A prime factor is counted only once, even if it divides n multiple times.
Input: n = 60
Output: 3
Explanation: The distinct prime factors of 60 are 2, 3, and 5. Therefore, the count is 3.
Input: n = 8
Output: 1
Explanation: Since 8 = 2³, its only distinct prime factor is 2. Therefore, the count is 1.
Input: n = 1
Output: 0
Explanation: The number 1 has no prime factors, so the count is 0.
Sign in to write, run, and submit your solution against the full test suite.