import Control.Applicative main :: IO () main = do n <- read <$> getLine print $ solve n solve :: Int -> Int solve n = maximum $ filter (check n) [1..n] check :: Int -> Int -> Bool check n x = sum [1..n] `mod` x == 0