import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); HashMap map = new HashMap<>(); for (int i = 0; i < n; i++) { int x = sc.nextInt(); map.put(x, map.getOrDefault(x, 0) + 1); } int max = 0; int level = 0; for (Map.Entry entry : map.entrySet()) { if (max <= entry.getValue()) { max = entry.getValue(); level = Math.max(level, entry.getKey()); } } System.out.println(level); } }