gets arr = gets.chomp.split.map(&:to_i) puts (arr.size / 2).odd? ? arr.sort![arr.size/2-1] + 0.5 : arr.sort![arr.size/2-1]