import Control.Monad ( replicateM ) import Data.List ( sort ) main = do n <- readLn getLine ws <- replicateM n readLn putStrLn . show $ solve ws solve :: [Int] -> Int solve ws = l - h where ws' = sort ws h = head ws' l = last ws'