import Data.List
f ::[Int] -> Int
f [] = 0
f [_] = 0
f (x:xs) = if (x /= head(xs)) then (0 + (f xs)) else (1 + (f xs))
main = do 
 getLine
 u <- map read . words <$> getLine
 let u' = sort u
 if f u == 0 then putStrLn "YES" else putStrLn "NO" 