#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[100];
for( int i = 0 ; i < n ; i ++ )
{
cin >> a[i];
}
int s = 0 , ans = 0;
for( int i = 0 ; i < n ; i ++ )
{
int cnt = 0;
for( int j = 0 ; j < n ; j ++ )
{
if(a[i] == a[j]) cnt ++;
}
if(s < cnt)
{
s = cnt;
ans = a[i];
}
}
cout << ans;
}