from collections import Counter n = int(input()) l = list(map(int, input().split())) co = Counter(l).items() co = sorted(co, reverse=True) co = sorted(co, key=lambda x:x[1], reverse=True) print(co[0][0])