#Mathematica, 46 bytes Tr[1^Union@Cases[FactorInteger@#,_?PrimeQ,2]]& <a href="https://tio.run/##y00syUjNTSzJTE78n277P6Qo2jAuNC8zP8/BObE4tTjaLTG5JL/IM68kNT21yEFZJ94@oCgzNzVQxyg2Vu0/kJ1XouCQHm1saG5gaGhpZhH7/z8A" title="Wolfram Language (Mathematica) – Try It Online">Try it online!</a> -4 bytes @JungHwan Min