from collections import Counter N = int(input()) listL = [int(i) for i in input().split()] counter = Counter(listL) counter = sorted(counter.items(), key=lambda x: x[1]) counter.reverse() print(counter[0][0])