-- import Prelude hiding (abs)
-- import Control.Monad
-- import Control.Arrow ((&&&))
-- import Data.List (nub, sort, group)
-- import Data.Maybe (fromMaybe)
-- import qualified Data.IntMap as M

main :: IO ()
main = do
    _ <- getLine
    as <- (map read . words) <$> getLine
    print $ solve as

-- |
solve :: [Int] -> Int
solve as = maximum as - minimum as
