n = input() cnt = [0] * 7 mode = 1 L = [int(x) for x in input().split()] for li in L: cnt[li] += 1 if cnt[li] >= cnt[mode] and li >= mode or cnt[li] > cnt[mode]: mode = li print(mode)