import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] types = new int[n]; for(int types_i=0; types_i < n; types_i++){ types[types_i] = in.nextInt(); } // your code goes here Map typeFreq = new HashMap(); for (int i=1; i <= 5; i++) { typeFreq.put(i,0); } for (int i=0; i < n; i++) { typeFreq.put(types[i], typeFreq.get(types[i]).intValue() + 1); } // Create TreeSet of Entry sorted by entry-value(frequency) and then by entry-key SortedSet> sortedEntrySet = new TreeSet>(new FreqValComparator()); sortedEntrySet.addAll(typeFreq.entrySet()); System.out.println(sortedEntrySet.iterator().next().getKey()); } private static class FreqValComparator implements Comparator> { public int compare(Map.Entry e1, Map.Entry e2) { int retVal = Integer.compare(e2.getValue().intValue(), e1.getValue().intValue()); if (retVal == 0) { return Integer.compare(e1.getKey().intValue(), e2.getKey().intValue()); } else { return retVal; } } } }