import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; import java.util.TreeMap; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] types = new int[n]; TreeMap map = new TreeMap(); map.put(1,0); map.put(2,0); map.put(3,0); map.put(4,0); map.put(5,0); for(int types_i=0; types_i < n; types_i++) { types[types_i] = in.nextInt(); Integer count = map.get(types[types_i]); map.put(types[types_i], count + 1); } int type_with_highest_frequency = -1; int highest_frequency = -1; int maxValueInMap = Collections.max(map.values()); for (Map.Entry entry : map.entrySet()) { if (entry.getValue()==maxValueInMap) { System.out.println(entry.getKey()); return; } } } }