import qualified Data.ByteString.Char8 as BS
import Data.Char
import Data.List

toInts :: IO [Int]
toInts = unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

solver :: Int -> [Int] -> Int
solver n ls =
  let m = div n 2
   in let (p, f) = splitAt m $ sort ls
       in (head f) - (last p)

main :: IO ()
main = do
  n <- read <$> getLine
  dat <- toInts
  print $ solver n dat