#include #include #include #include using namespace std; int main(){ int n; cin >> n; vector types; int in; for(int types_i = 0; types_i < n; types_i++){ cin >> in; types.push_back(in); } // your code goes here sort(types.begin(), types.end()); map freq; int previous = *types.begin(); for (vector::iterator i =types.begin(); i!= types.end(); ++i ){ if (i == types.begin()) freq.insert((make_pair(*i, 0))); if(previous == *i){ freq.find(*i)->second++; } else{ //cout << "index: " << previous << "value: "; //cout<second << endl; previous = *i; freq.insert(make_pair(*i, 0)); freq.find(*i)->second++; } } int c_max=0, index; for (map::iterator i = freq.begin(); i != freq.end(); ++i){ //cout << "--" << i->first << "--" << i->second <second > c_max){ c_max = i->second; index = i->first; } } cout << index; return 0; }