#include <iostream>
#include <map>
using namespace std;
int main()
{
int in[] = {3, 5, 2, 3, 5, 2, 5, 2, 1, 5};
const int n = sizeof(in)/sizeof(in[0]);
map<int, int> bucket;
for (int ii = 0; ii < n; ++ii)
{
++bucket[in[ii]];
}
for (map<int, int>::const_iterator it = bucket.begin();
it != bucket.end();
++it)
{
for (int ii = 0; ii < it->second; ++ii)
{
cout << it->first;
}
cout << endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8bWFwPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCgppbnQgbWFpbigpCnsKICAgIGludCBpbltdID0gezMsIDUsIDIsIDMsIDUsIDIsIDUsIDIsIDEsIDV9OwogICAgY29uc3QgaW50IG4gPSBzaXplb2YoaW4pL3NpemVvZihpblswXSk7CgogICAgbWFwPGludCwgaW50PiBidWNrZXQ7CiAgICBmb3IgKGludCBpaSA9IDA7IGlpIDwgbjsgKytpaSkKICAgIHsKICAgICAgICArK2J1Y2tldFtpbltpaV1dOwogICAgfQoKICAgIGZvciAobWFwPGludCwgaW50Pjo6Y29uc3RfaXRlcmF0b3IgaXQgPSBidWNrZXQuYmVnaW4oKTsKICAgICAgICBpdCAhPSBidWNrZXQuZW5kKCk7CiAgICAgICAgKytpdCkKICAgIHsKICAgICAgICBmb3IgKGludCBpaSA9IDA7IGlpIDwgaXQtPnNlY29uZDsgKytpaSkKICAgICAgICB7CiAgICAgICAgICAgIGNvdXQgPDwgaXQtPmZpcnN0OwogICAgICAgIH0KICAgICAgICBjb3V0IDw8IGVuZGw7CiAgICB9CgogICAgcmV0dXJuIDA7Cn0K