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(); Integer[] types = new Integer[n]; for(int types_i=0; types_i < n; types_i++){ types[types_i] = in.nextInt(); } List ints = Arrays.asList(types); HashMap typeCount = new HashMap(); typeCount.put(1, 0); typeCount.put(2, 0); typeCount.put(3, 0); typeCount.put(4, 0); typeCount.put(5, 0); // System.out.println("ints"); //System.out.println(ints); ints.forEach(x ->{ typeCount.put(x, typeCount.get(x)+1); } ); // System.out.println(typeCount); // your code goes here Integer max = Collections.max(typeCount.values()); ArrayList maxKeys = new ArrayList(); for(Integer key: typeCount.keySet()){ if(typeCount.get(key) == max){ maxKeys.add(key); } } System.out.println(Collections.min(maxKeys)); } }