import           Control.Applicative
import           Control.Monad
import           Data.List.Split

getResult :: [Int] -> Int
getResult nums = maximum nums - minimum nums

main :: IO ()
main = do
  getLine
  input <- getLine
  let nums = map read (splitOn " " input) :: [Int]
  print $ getResult nums
