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]; Map m = new HashMap<>(); for(int types_i=0; types_i < n; types_i++){ types[types_i] = in.nextInt(); if (m.get(types[types_i]) != null) { m.put(types[types_i], m.get(types[types_i]) + 1); }else { m.put(types[types_i], 1); } } int maxCount = -1, maxBird = -1; for (Integer bird : m.keySet()) { if (m.get(bird) > maxCount) { maxCount = m.get(bird); maxBird = bird; } } System.out.println(maxBird); // your code goes here } }