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]; Map m = new HashMap(); for(int types_i=0; types_i < n; types_i++){ int type = in.nextInt(); if (!m.containsKey(type)) m.put(type,1); else m.put(type, m.get(type) + 1); } int max =(Collections.max(m.values())); for (Map.Entry entry : m.entrySet()) { if (entry.getValue()==max) { System.out.println(entry.getKey()); break; } } } }