n = int(input()) l = list(map(int, input().split())) l2 = list(set(l)) l3 = [] for i in l2: l3.append([l.count(i), i]) print(sorted(l3)[::-1][0][1])