_n = gets.to_i l = gets.split.map(&:to_i) puts l.tally.max_by { |k, v| [v, k] }[0]