class Calc0079 def initialize(args) args = args.map { |l| l.chomp.split(/\s+/) } @n = args.shift.first.to_i @ls = args.shift.map(&:to_i) end def run hs = @ls.group_by(&:itself).map {|l, g| [l, g.size] } hs.sort_by { |h| [-h[1], -h[0]] }.first.first end end puts Calc0079.new(STDIN.readlines).run if __FILE__ == $0