#!/bin/python import sys n = int(raw_input().strip()) types = map(int, raw_input().strip().split(' ')) # your code goes here m={} m[1]=(types.count(1)) m[2]=types.count(2) m[3]=types.count(3) m[4]=types.count(4) m[5]=types.count(5) l=max(m.values()) k=[i for i,j in m.items() if j==l] print min(k)