-- yukicoder My Practice -- author: Leonardone @ NEETSDKASU main = print . solve =<< readLn solve n = ans where t = filter f $ takeWhile g [1..] f x = mod n x == 0 g x = x * x <= n d = if last t ^ 2 == n then -1 else 0 ans = d + 2 * length t