N = int(input())
l = list(map(int, input().split()))
current = 0
currentCount = 0

l.sort()

for i in range(1, 7):
    if i > current:
        if l.count(i) >= currentCount and i > current:
            currentCount = l.count(i)
            current = i

print(current)