n = gets.to_s.to_i a = gets.to_s.split.map(&.to_i) (1...n).each do |i| temp_itr = i - 1 t = a[i] while 0 <= temp_itr && t <= a[temp_itr] a[temp_itr + 1] = a[temp_itr] a[temp_itr] = t temp_itr -= 1 end end if a.size % 2 == 1 puts a[n // 2] else h = n // 2 r = (a[h] + a[h - 1]).to_f puts r / 2 end