#include
using namespace std;
int main()
{
int n;
cin >> n;
int niza[n + 1];
int cnt[1001];
for(int i = 0; i < 1000; i++) {
cnt[i] = 0;
}
for(int i = 0; i < n; i++) {
cin >> niza[i];
cnt[niza[i]]++;
}
int maks = 0, broj = 0;
for(int i = 0; i < 1000; i++) {
if(maks < cnt[i]) {
maks = cnt[i];
broj = i;
}
}
cout << broj << endl;
return 0;
}