#!/bin/python3 import sys n = int(input().strip()) types = list(map(int, input().strip().split(' '))) # your code goes here type1count = 0 type2count = 0 type3count = 0 type4count = 0 type5count = 0 for item in types: if item == 1: type1count +=1 elif item ==2: type2count +=1 elif item ==3: type3count +=1 elif item ==4: type4count +=1 else: type5count +=1 typecountlist = [type1count, type2count, type3count, type4count, type5count] numbers = [] for item in typecountlist: numbers.append(item) numbersmax = max(numbers) #numbers = [1,0,1,3,1] kinds_types = [1,2,3,4,5] final = [] for i in range(0,5): if numbers[i] == numbersmax: final.append(kinds_types[i]) print(min(final))