from collections import defaultdict N = int(input()) L = list(map(int,input().split())) counter= defaultdict(int) for l in L: counter[l]+=1 ans=0 now=0 for c in counter.items(): if c[1]>=now: now=c[1] if c[0]>ans: ans=c[0] print(ans)