#include
#include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
int a[n];
int j=0;
unordered_map<int,int>mp;
for(int i=0;i<n;i++){
cin>>a[i];
mp[a[i]]++;
}
int max=0;
int ans;
for(auto it:mp){
if(it.second>max){
max=it.second;
ans=it.first;
}
}
cout<<ans;
return 0;
}