gets array = gets.split.map(&:to_i).sort puts array.size.odd? ? array[array.size / 2] : (array[array.size / 2 - 1] + array[array.size / 2]) / 2.to_f