#include <bits/stdc++.h>
using namespace std;
int tab[1000001];
int main() {
int n, max=-1, odp,x;
cin>>n;
for(int j=0;j<n;j++){
cin>>x;
tab[x]++;
}
for(int i=0;i<=100000;i++) {
if(tab[i]>max) {
max=tab[i];
odp=i;
}
}
cout << odp;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiAKaW50IHRhYlsxMDAwMDAxXTsKIAppbnQgbWFpbigpIHsKCQoJaW50IG4sIG1heD0tMSwgb2RwLHg7CgljaW4+Pm47Cglmb3IoaW50IGo9MDtqPG47aisrKXsKCQljaW4+Png7CgkJdGFiW3hdKys7Cgl9Cglmb3IoaW50IGk9MDtpPD0xMDAwMDA7aSsrKSB7CgkJaWYodGFiW2ldPm1heCkgewoJCQltYXg9dGFiW2ldOwoJCQlvZHA9aTsKCQl9Cgl9Cgljb3V0IDw8IG9kcDsKIAoJcmV0dXJuIDA7Cn0=