import Control.Applicative ((<$>)) import Data.Char (isSpace) import Data.List (unfoldr, sort) import Data.ByteString.Char8 (ByteString) import qualified Data.ByteString.Char8 as B getL :: (ByteString -> [Int]) -> IO [Int] getL f = f <$> B.getLine readIL :: (ByteString -> Maybe (Int, ByteString)) -> (ByteString -> [Int]) readIL f = unfoldr g where g s = do (n, s') <- f s return (n, B.dropWhile isSpace s') main :: IO () main = do B.getLine putStrLn =<< solve <$> getL (readIL B.readInt) solve :: [Int] -> String solve xs = if any (== 0) xss then "NO" else if all (== (head xss)) xss then "YES" else "NO" where xss = f $ sort xs f :: [Int] -> [Int] f [x] = [] f (x:y:ys) = (y - x) : f (y:ys)