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