ary = []
count = Hash.new(0)
while tmp = gets
  break if tmp.to_i == 0
  ary << tmp.to_i
end

ary.each do |ary_i|
  count[ary_i] += 1
end

max = count.map(&:last).max
# p count.select{|_,v| v == max }
count.select{|_,v| v==max}.sort_by{|k,_| k }.each do |k,_|
  puts k
end
