#!/bin/python3

import sys


n = int(input().strip())
types = list(map(int, input().strip().split(' ')))
counts = [0,0,0,0,0,0]
for bird in types:
    counts[bird] += 1
winner = 0
for x in range(6):
    if counts[x] > counts[winner]:
        winner = x
print(winner)