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]; for(int types_i=0; types_i < n; types_i++){ types[types_i] = in.nextInt(); } int max_count = 0; Arrays.sort(types); String type = Arrays.toString(types); type = type.replace("[",""); type = type.replace("]",""); type = type.replace(",",""); Set num = new HashSet(Arrays.asList(type.split(""))); int max_num = 0; num.remove(" "); for(String str : num) { int size = type.length()-type.replace(str,"").length(); if(size > max_count) { max_count = size; max_num = Integer.parseInt(str); } } System.out.println(max_num); in.close(); } }