{-# LANGUAGE Arrows #-} import Control.Arrow import Data.List (group, sortBy) import Data.Ord factor 1 = [] factor n = map (head &&& length) . group $ helper n 2 where helper n x | x * x > n = if n > 1 then [n] else [] | n `mod` x == 0 = x : helper (n `div` x) x | otherwise = helper n (x+1) can n | length fs > 2 = True | length fs == 2 && (snd . head . reverse . sortBy (comparing snd)) fs >= 2 = True | length fs == 1 && (snd . head . reverse . sortBy (comparing snd)) fs >= 3 = True | otherwise = False where fs = factor n main = do n <- readLn putStrLn $ if can n then "YES" else "NO"