A firmware event log records n status codes (non-negative integers). Two codes are placed in the same group if and only if they have the same Hamming weight (the number of 1 bits in their binary representation).
Given the log, report the size of the largest such group.
Line 1: an integer n.
Line 2: n space-separated non-negative integers, the status codes.
A single integer: the number of codes in the largest Hamming-weight group.
Example 1
Input
5 1 2 3 4 5
Expected
3
Explanation
Weights are 1,1,2,1,2 for the five codes; weight 1 occurs three times, which is the largest group.
Example 2
Input
1 7
Expected
1
Explanation
With a single code, its group size is always 1.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →