map(int, input().split()) *a, = map(int, input().split()) z = [0] * 10 for v in a: z[v]+=1 print(max(a, key=lambda v:(z[v], v)))