
import Data.List (sort)

solve :: [Int] -> Int
solve (_:p)  = 
    v2 - v1
    where 
        l = length p
        (p1,p2) = splitAt (div l 2) $ sort p
        v1 = maximum p1
        v2 = minimum p2
    
main = interact $ show.solve.map read.words
