{-# LANGUAGE BangPatterns #-}

import qualified Data.ByteString.Char8 as B
import           Data.Char
import           Data.List
import qualified Data.Sequence         as C

main :: IO ()
main = do
    n <- readLn
    as <- unfoldr (B.readInt . B.dropWhile isSpace) <$> B.getLine
    print $ solve n as

solve :: Int -> [Int] -> Int
solve n xs = median $ go 0 (n-1) C.empty xs
    where
        go !a !b !ys [] = ys
        go  0 !b !ys (x:xs) = go 1 (b-1) (x C.<| ys) xs
        go !a !b !ys (x:xs)
            | a < b
                = go (a+1) (b-1) (C.replicate (2*a) x C.>< ys) xs
            | otherwise
                = go (a+1) (b-1) (C.replicate (2*b+1) x C.>< ys) xs

median :: C.Seq Int -> Int
median xs = let ys = C.unstableSort $ xs
            in ys `C.index` ((C.length ys) `div` 2)
