N = int(input()) L = list(map(int, input().split())) t = [0] * (N + 1) for l in L: t[l] += 1 print(max(i for i in range(1, N + 1) if t[i] == max(t)))