#include using namespace std; int main(){ int n; cin >> n; vector types(n); for(int types_i = 0; types_i < n; types_i++){ cin >> types[types_i]; } map histogram; for(int type : types) { if(histogram.find(type) != histogram.end()) ++histogram[type]; else histogram.insert(std::pair(type, 1)); } int maxType = 1; for(auto pair : histogram) { if(histogram[maxType] < pair.second && maxType < pair.first) maxType = pair.first; } cout << maxType; return 0; }