require 'pp' n = gets.to_i max = gets.split(' ') .map{|e| e.to_i} .group_by{|e| e} .map{|k, e| [k, e.length]} .to_h .max_by{|k, v| v} puts max[0]