import java.io.*; import java.util.*; 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(); } ArrayList al=new ArrayList(); HashMap h=new HashMap(); for (int i = 0; i < n; i++) { al.add(types[i]); } for (int i = 0; i < al.size(); i++) { if(!h.containsKey(al.get(i))){ h.put(al.get(i), 1); } else{ h.put(al.get(i), h.get(al.get(i))+1); } } Collection c=h.values(); int result=0; int max=Collections.max(c); for(Entry e1:h.entrySet()){ if(e1.getValue()==max){ result=e1.getKey(); break; } } System.out.println(result); } }