Number Groups
We say that two natural numbers are in the same group when they have the same number of ones in their binary representation. For example, and are in the same group because and , so both numbers have two ones in their binary representation. On the contrary, and belong to different groups.
Problem
Write a program in one of the IOI languages that reads a sequence of numbers and then finds the number of members in the largest group that can be formed from terms of the sequence. The sequence may contain equal terms, and in this case, you should include all equal terms in the same group.
Input Files:
The input files named aces.in are text files consisting of two lines: The first line contains exactly one integer: the number N of numbers in the sequence . The second line contains integers A , separated in pairs by a single space: the terms of the sequence.
Output Files:
The output files named aces.out are text files consisting of exactly one line containing exactly one integer: the number of members in the largest group consisting of terms from the sequence.
Example of Input - Output Files:
STDIN (aces.in)
6
1 2 4 3 2 5
STDOUT (aces.out)
4
Explanation: In the largest group belong: , (twice), and , which have one in their binary representation.
Formatting: In the output, each line terminates with a newline
character.
Maximum execution time: 1 sec.
Maximum available memory: 16 MB.
Comments