import java.util.Arrays; import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int []L = new int[N]; for(int i = 0; i < N; i++) { L[i] = scan.nextInt(); } scan.close(); Arrays.sort(L); int ans = 0; int temp = L[0]; int cnt1 = 1; int cnt2 = 1; for(int i = 1; i < N; i++) { if(temp == L[i]) { cnt1 ++; }else { temp = L[i]; cnt1 = 1; } if(cnt1 >= cnt2) { cnt2 = cnt1; ans = L[i]; } } System.out.println(ans); } }