perl  -nale 'BEGIN{$_=<>}
sub mid {(sort {$a<=>$b} @_)[int(@_/2)]}
@M;
for $x(0..$#F){
    for$y($x..$#F){
        $M[mid(@F[$x..$y])] ++;
    }
}

$cnt= int(@F*(@F+1)/2/2)+1;
$tmp=0;
for(0..$#M){
    $tmp+=$M[$_];
    if($tmp >= $cnt){
        print $_;
        exit;
    }
}
'