import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust)
import Data.List

readIntsLine :: IO [Int]
readIntsLine = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

main :: IO ()
main = do
  getLine
  ds <- sort <$> readIntsLine
  let mid = length ds `div` 2
  let s = last $ take mid ds
  let e = head $ drop mid ds
  print $ max (e - s) 0