{-# LANGUAGE BangPatterns #-}

import qualified Data.ByteString.Char8 as B
import           Data.Char
import qualified Data.IntMap           as M
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) M.empty xs
    where
        go :: Int -> Int -> M.IntMap Int -> [Int] -> M.IntMap Int
        go !a !b !ys [] = ys
        go  0 !b !ys (x:xs) = go 1 (b-1) (M.insertWith (+) 1 x ys) xs
        go !a !b !ys (x:xs)
            | a < b
                = go (a+1) (b-1) (M.insertWith (+) (2*a) x ys) xs
            | otherwise
                = go (a+1) (b-1) (M.insertWith (+) (2*b+1) x ys) xs

median :: M.IntMap Int -> Int
median xs = go ((M.foldr (+) 0 xs) `div` 2) xs
    where
        go h xs = let ((k, v), ys) = M.deleteFindMin xs
                  in if v > h then k else go (h-v) ys
