import java.util.*; class migrate { public static void main(String ar[]) { Scanner sc= new Scanner(System.in); int n= sc.nextInt(); int arr[]= new int[n]; for(int i=0; i result= new HashSet<>(); Arrays.sort(arr); for(int c: arr) { result.add(c); } int max= Integer.MIN_VALUE; int count=0; int value=0; for(int i: result) { count=0; for(int j=0; jmax) { max= count; value=i; } } System.out.println(value); } }