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

main = do
  n <- readLn :: IO Int
  xs <- map ((read :: String -> Int) . BS.unpack) . BS.words <$> BS.getLine
  let n2=n `div` 2
      xs2=group $ sort xs
      ys= take 2 $ filter (\e->snd e>=n2) $ zip (map head xs2) $ scanl1 (+) $ map length $ xs2
  print $ if length ys>1 && (snd (head ys))==n2 then (fst (ys!!1)) - (fst (ys!!0))  else 0