import qualified Data.ByteString.Char8 as C
import Data.List
import qualified Data.Vector.Unboxed as V

main = C.interact $ C.pack . show . sol . get

get = V.tail . V.unfoldr (C.readInt . C.dropWhile (<'0'))

sol = (-) <$> V.maximum <*> V.minimum