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]; int type; for(int types_i=0; types_i < n; types_i++){ types[types_i] = in.nextInt(); } type = birdCount(types); System.out.println(type); } static public int birdCount(int[] types){ Arrays.sort(types); int prev = types[0]; int type = types[0]; int count = 1; int maxCount = 1; int length = types.length; for (int i = 1; i < length; i++) { if (types[i] == prev) { count++; } else { if (count > maxCount) { type = types[i - 1]; maxCount = count; } prev = types[i]; count = 1; } } return count > maxCount ? types[length - 1] : type; } }