#include <bits/stdc++.h>

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> types(n);
    for(int types_i = 0; types_i < n; types_i++){
       cin >> types[types_i];
    }
    sort(types.begin(), types.end());
    int cur = types[0], ans = cur;
    int t = 1;
    int max_ = 1;
    for(int i = 1; i < n; i++){
        if(types[i] == cur){
            t++;
        }else{
            cur = types[i];
            t = 1;
        }
        if(t > max_){
            max_ = t;
            ans = cur;
        }
    }
    cout << ans;
    return 0;
}