PEG 11/12 Programming Test 1 - October 19

Problem 2: Cyclopian Suits

After securing a steady supply of oxygen, FurWear is ready to begin production of their fine apparel. Unfortunately, since the Oelfinn are giants, it takes a long time to make clothing for them, so FurWear can only make one size of clothing. They have acquired the Cyclopian census data and would like to find the most common size. Can you help them?

Input

The first line consists of a single integer N (1 ≤ N ≤ 50 000). The following N lines each contain a single integer ai (10 ≤ ai ≤ 1000), the size of clothing worn by the ith Oelfinn.

Output

Output the number of most common sizes, followed by the most common sizes in ascending order, each on a separate line.

Sample Input

5
30
34
30
20
34

Sample Output

2
30
34

All Submissions
Best Solutions


Point Value: 3
Time Limit: 2.00s
Memory Limit: 16M
Added: Oct 17, 2011
Author: jargon

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

Comments (Search)

It works for whatever test case I can think of, but only works for 1 test case in the judge.
If anyone could help I would appreciate it.
Thanks.
:-)

The question asks for the quantity of modes, not the quantity of each mode.

That is, for this case:
 
3
10
20
20

the output should be:
 
1
20

and not:
 
2
20

Thanks!
helped alot


I mean what about the number 20 ? I see all other numbers appear in the sample output but number 20 ...

Did you read the question? Furthermore, you can edit your messages, instead of having multiple threads.

I'm not too sure why my code isn't working. It works for the same input/output, but fails on the actual test cases.

You need to make up more test cases on your own. You make an incorrect assumption that causes you to output sizes that are not the most common.