#include using namespace std; int main(){ int n, id; cin >> n; pair histogram[5]; for (int i = 0; i < 5; i++) histogram[i] = { i+1, 0 }; for(int types_i = 0; types_i < n; types_i++){ cin >> id; histogram[--id].second++; } sort(histogram, histogram+5, [](pair& x, pair& y)->bool { return x.second > y.second || x.second == y.second && x.first < y.first; } ); // your code goes here cout << histogram[0].first; return 0; }