Sean is sure he is a great code breaker. He knows that every cipher in the world can be broken by frequency analysis, but he has the wrong idea about what frequency analysis actually is.
He intercepted an enemy message. The message consists of N integers, each at most C.
Sean believes frequency analysis means sorting the sequence so that more frequent numbers come before less frequent ones. Formally, if X occurs more times than Y in the original sequence, then X comes before Y. If two numbers occur the same number of times, the one that appears earlier in the input comes first.
Help Sean by writing a frequency sorter.