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) = 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"