#!/bin/python3 import sys n = int(input().strip()) types = list(map(int, input().strip().split(' '))) # your code goes here print(max([(c, len(list(filter(lambda x: x == c, types)))) for c in range(1, 6)], key=lambda x: x[1])[0])