#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;
}
