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

    }
    cout << ans << endl;
    return 0;
}
