import Control.Monad (liftM2) main :: IO () main = getLine >> getLine >> getContents >>= print . liftM2 (-) maximum minimum . map (read :: String -> Int) . lines