import Control.Applicative import Data.List f 2 _ = "YES" f n (x:xs) = if ((x2 - x1) == (x3 - x2)) && ((x2 - x1) /= 0) then f (n-1) xs else "NO" where x1 = x x2 = xs !! 0 x3 = xs !! 1 main = do n <- getLine xs <- (map read . words) <$> getLine putStrLn $ f (read n) (sort xs)