#!/bin/ruby def largest(hash) return hash.max_by{|k,v| v} end n = gets.strip.to_i types = gets.strip types = types.split(' ').map(&:to_i) freq = types.inject(Hash.new(0)) {|h,v| h[v] +=1; h} freq = freq.sort.to_h k,v = largest(freq) puts k