import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; import java.util.Map.Entry; 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(); } Map map = getTypeMap(types); System.out.println( getMaxCountType(map)); } public static Map getTypeMap(int[] types) { Map map = new HashMap(); for(int type:types) { if(map.containsKey(type)) { int count = map.get(type) + 1; map.put(type,count); }else { map.put(type,1); } } return map; } public static String getMaxCountType(Map map) { if(map.size()==0) return ""; int type = -1; int maxCount = 0; for(Entry item : map.entrySet()) { int itemCount = item.getValue(); if(itemCount>maxCount) { type = item.getKey(); maxCount = itemCount; } } return String.valueOf(type); } }