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); HashMap hm = new HashMap(); int n = in.nextInt(); for(int types_i=0; types_i < n; types_i++){ int a; a = in.nextInt(); if(hm.containsKey(a)){ hm.put(a,hm.get(a)+1); } else{ hm.put(a,1); } } Map.Entry maxEntry = null; for (Map.Entry entry : hm.entrySet()) { if (maxEntry == null || entry.getValue().compareTo(maxEntry.getValue()) > 0) { maxEntry = entry; } } System.out.println(maxEntry.getKey()); } }