n = int(input()) lst = list(map(int, input().split())) s = set(lst) dic = {} for i in s: dic[i] = lst.count(i) count_max = 0 for key in dic: # 现在的字典会的key会自动以字典序升序排序,这里就会导致先遍历到的不是列表中最先出现的数据 count = dic.get(key) if count > count_max: count_max = count for i in lst: if lst.count(i) == count_max: print(i) break