#!/bin/python3 import sys n = int(input().strip()) types = list(map(int, input().strip().split(' '))) first,second,third,fourth,fifth = [0, 0, 0, 0, 0] for i in range(n): if types[i] == 1: first += 1 elif types[i] == 2: second += 1 elif types[i] == 3: third += 1 elif types[i] == 4: fourth += 1 elif types[i] == 5: fifth += 1 type = {1:first,2:second,3:third,4:fourth,5:fifth} most = max(type.values()) modeType = [x for x,y in type.items() if y == most] if len(modeType) == 1: print(modeType[0]) elif len(modeType) > 1: print(min(modeType))