int main() {
int n;
cin >> n;
int supportspace[10000] = {0};
while (n--)
{
//cout << n;
int num;
cin >> num;
supportspace[num]++;
}
//寻找次数最多的数
int max = 0,xiabiao=0;
for (int i = 0; i < 10000; i++)
{
if (supportspace[i]>max) {
max = supportspace[i];
}
}
for (int i = 0; i < 10000; i++)
{
if (supportspace[i] < max) {
supportspace[i]=0;
}
}
while (true)
{
if (supportspace[xiabiao] == max) {
break;
}
xiabiao++;
}
cout << xiabiao;
}