import Data.List main = getLine >> getLine >>= putStrLn . solve . sort . map read . words solve x = if maximum d == minimum d && maximum d /= 0 then "YES" else "NO" where d = zipWith (-) x (tail x)