#!/bin/ruby n = gets.strip.to_i types = gets.strip types = types.split(' ').map(&:to_i) # your code goes here ary = [0,0,0,0,0] types.each{|t| ary[t-1] += 1} max = 0 max_type = 0 ary.each_with_index do |v, idx| if v > max max = v max_type = idx + 1 end end puts max_type