//Highest frequency calculator
#include
#include
using namespace std;
int main() {
int n,x;
cin>>n;
map<int,int> freq;
for(int i=0;i<n;i++){
cin>>x;
freq[x]++;
}
int c=0;
int max=0;
for(auto it = freq.begin();it!=freq.end();it++){
if(it->second > max){
max = it->second;
c = it->first;
}
}
cout<<c;
return 0;
}