#!/bin/python3 import sys n = int(input().strip()) types = list(map(int, input().strip().split(' '))) count = [0, 0, 0, 0, 0] for i in types: count[i-1]+=1 common = [i for i in range(5) if count[i]==max(count)] print(min(common)+1)