#include <bits/stdc++.h>
#include <vector>

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> types(n);
    vector<int> numbers(6, 0);
    for(int types_i = 0; types_i < n; types_i++){
       cin >> types[types_i];
       numbers[types[types_i]]++;
    }
    int max = numbers[5];
    int max_c = 5;
    for(int i = 5; i > 0; i--){
        if(numbers[i] >= max){max = numbers[i]; max_c = i;}
    }
    cout << max_c;
    return 0;
}