import Control.Monad import Data.List main = do n <- readLn getLine ns <- sort <$> replicateM n readLn print $ (last ns) - (head ns)