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(); Map types = new HashMap<>(); for (int types_i = 0; types_i < n; types_i++) { int typeVal = in.nextInt(); Integer val = types.get(typeVal); if(val == null) { types.put(typeVal, 1); } else { types.put(typeVal, val + 1); } } int[] maxTypeNum = new int[2]; maxTypeNum[1] = Integer.MIN_VALUE; for(Integer i : types.keySet()) { if(types.get(i) > maxTypeNum[1]) { maxTypeNum[0] = i; maxTypeNum[1] = types.get(i); } } System.out.println(maxTypeNum[0]); } }