import Data.List(sort) main :: IO () main = getContents >>= putStrLn . compute . sort . tail . map readInt . words readInt :: String -> Int readInt = read compute :: [Int] -> String compute (x1:x2:xs) | x2-x1 == 0 = "NO" | otherwise = checkList xs (x2-x1) x2 checkList :: [Int] -> Int -> Int -> String checkList [] _ _ = "YES" checkList (x:xs) diff lst | lst == x - diff = checkList xs diff x | otherwise = "NO"