import Control.Monad

main = do
  n <- read <$> getLine
  xs <- forM [1..n] $ \t -> do
    read <$> getLine
  putStrLn . show . solve $ xs

solve xs = snd $ foldr (\x (cur,ys) -> if cur == x then (cur,ys) else (x,x:ys)) (-1,[]) $ sort xs