open Printf
open Scanf

let id x = x

let n = scanf "%d" id
let vs = Array.init n (fun i -> scanf " %d" id)

let median src =
    let a = Array.copy src in
    Array.sort (fun x y -> x - y) a;
    a.(Array.length a / 2)

let rec insert x l =
    match l with
    | [] -> [x]
    | v :: vs -> if v > x then x :: v :: vs else v :: insert x vs

let rec remove x l =
    match l with
    | [] -> failwith "remove"
    | v :: vs -> if v = x then vs else v :: remove x vs


let () =
    let len = Array.length vs in
    let lis = ref [] in
    for st = 0 to len - 1 do
        let sub = ref [] in
        for ed = st to len - 1 do
            sub := insert vs.(ed) !sub;
            let ll = ed - st + 1 in
            let idx = ll / 2 in
            let v = List.nth !sub idx in
            lis := insert v !lis
        done;
    done;
    let result = median (Array.of_list !lis) in
    printf "%d\n" result
