#include #include int main(){ int n, thisType, maxCount, maxType, thisCount; std::unordered_map typeCount = {{1,0}, {2,0}, {3,0}, {4,0}, {5,0}}; std::cin >> n; for (int i = 0; i < n; i++){ std::cin >> thisType; if (typeCount.find(thisType) != typeCount.end()) typeCount.at(thisType)++; else typeCount.insert({thisType, 1}); } /* Now found the highest count from hash table */ maxCount = maxType = 0; for (int i = 1; i < 6; i++){ thisCount = typeCount.at(i); if (thisCount > maxCount){ maxCount = thisCount; maxType = i; } } std::cout << maxType; return 0; }