public static int PrimeFactorsCount(int n)
{
if(n==1)
{
return 0;
}
var num = 0;
if (n % 2 == 0)
{
num++;
while (n % 2 == 0)
{
n /= 2;
}
}
for (int i = 3; i <= Math.Sqrt(n); i += 2)
{
if (n % i == 0)
{
num++;
while (n % i == 0)
{
n /= i;
}
}
}
if (n > 2)
num++;
return num;
}