#include<bits/stdc++.h>
using namespace std;

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define csl ios_base::sync_with_stdio(false);cin.tie(NULL);

const int N = 2*1e5+5;

int main()
{
    csl;
    int n,d;
    cin>>n;
    long int a[N]={0};
    rep(i,1,n+1)
    {
        cin>>d;
        a[d]++;
    }
    int mx = -1000000;
    int ans = 1;
    rep(i,1,n+1)
    {
        if(a[i]>mx)
        {
            mx = a[i]; 
            ans = i;
        }
    }
    cout<<ans;
	return 0;
}