import java.util.Scanner; public class MigratoryBirds { public static void main(String[] args) { Scanner in=new Scanner(System.in); int n=in.nextInt(); int[] ar=new int[n+1]; for(int i=0;i<=n;i++) ar[i]=0; for(int i=1;i<=n;i++){ ar[in.nextInt()]++; } int greatest=0; int bird=0; for(int i=1;i<=n;i++){ if(ar[i]>greatest) { greatest=ar[i]; bird=i; } } System.out.println(bird); } }