import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Scanner; public class Birds { public static void main(String args[]) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] types = new int[n]; Map map = new HashMap<>(); for(int types_i=0; types_i < n; types_i++){ types[types_i] = in.nextInt(); if(map.containsKey(types[types_i])) { map.put(types[types_i], map.get(types[types_i])+1); } else { map.put(types[types_i], 1); } } int maxValue = 0; int maxKey = 0; Iterator itr = map.entrySet().iterator(); while(itr.hasNext()) { Map.Entry pair = (Map.Entry)itr.next(); if(pair.getValue()>maxValue) { maxKey = pair.getKey(); maxValue = pair.getValue(); } } System.out.println(maxKey); } }