#include #include #include using namespace std; int main(){ fstream fh; fh.open ("pooh.in", fstream::in); int N; fh >> N; std::map jars; int a; while (fh >> a) { jars[a]++; } std::map::iterator it; int max = 0; int index; for ( it=jars.begin() ; it != jars.end(); it++ ) { int buf = (*it).first * (*it).second; if (max <= buf) { max = buf; index = (*it).first; } } fh.close(); fstream out; out.open ("pooh.out", fstream::out); out << index << endl; out.close(); return 0; }