module Main where

import Control.Applicative
import Control.Monad

main :: IO ()
main = do
    getLine
    as <- fmap read . words <$> getLine :: IO [Int]
    print $ abs $ (maximum as) - (minimum as)