N = int(input()) L = list(map(int,input().split())) max = 0 L.sort() L2 = sorted(list(set(L))) for i in L2: if max <= L.count(i): max = L.count(i) ans = i print(ans)