N=input() L = map(int, raw_input().split()) deg = [0] * 7 ans = 0 index = 0 for x in L: deg[x] += 1 if (ans <= deg[x]): ans = deg[x] index = max(index, x) print index