the solution of the CountFactors