N = int(input()) l = list(map(int, input().split())) s = set(l) a = [0,0] for i in s: #print(l,i,l.count(i)) if l.count(i)>a[1]: a = [i, l.count(i)] print(a[0])