#include using namespace std; struct cmp{ bool operator()(vector a,vector b){ return (a[1] > b[1]); } }; int main(){ int n; cin >> n; vector types(n); vector > v(6,vector(2,0)); for(int i=0;i<6;i++) v[i][0]=i; for(int types_i = 0; types_i < n; types_i++){ cin >> types[types_i]; v[types[types_i]][1]++; } sort(v.begin(),v.end(),cmp()); cout << v[0][0] << endl; return 0; }