N=int(input()) L=sorted(map(int,input().split())) D={} for x in L: if x not in D:D[x]=0 D[x]+=1 K,V=0,0 for k,v in D.items(): if v>V:K=k;V=v if v==V:K=k print(K)