class A def initialize n = gets.chomp.to_i l = gets.chomp.split(' ').map(&:to_i) p l.group_by{|i| l.count(i)}.first.last.uniq.sort.last end end A.new