#Mathematica, 50 bytes Tr[1^Select[Union[Join@@FactorInteger@#],PrimeQ]]& <a href="https://tio.run/##y00syUjNTSzJTE78n277P6Qo2jAuODUnNbkkOjQvMz8v2is/M8/BwS0xuSS/yDOvJDU9tchBOVYnoCgzNzUwNlbtP5CVV6LgkB5tbGhuYGhoaWYR@/8/AA" title="Wolfram Language (Mathematica) – Try It Online">Try it online!</a>