n = gets.to_i l = gets.split.map(&:to_i) c = Array.new(6, 0) n.times do |i| c[l[i] - 1] += 1 end id = 0 max = 0 6.times do |i| if c[i] > max id = i max = c[i] elsif c[i] == max if i > id id = i end end end puts id + 1