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(); List types = new ArrayList(); for(int i = 0; i < n; i++){ types.add(Integer.toString(in.nextInt())); } int max = 0; int curr = 0; String currKey = null; Set unique = new HashSet(types); for (String key : unique) { curr = Collections.frequency(types, key); if(max < curr){ max = curr; currKey = key; } } System.out.println(currKey); } }