#K74112. Unique Binary Ones Count
Unique Binary Ones Count
Unique Binary Ones Count
You are given \( T \) test cases. For each test case, you are provided with an integer \( M \) followed by \( M \) integers. Your task is to compute, for each test case, the number of unique counts of ones in the binary representations of the given integers.
Formally, for an integer \( n \), let its binary representation be denoted as \( \text{bin}(n) \). Define \( f(n) \) as the number of ones in \( \text{bin}(n) \). For each test case, you must output the value of
[ |{ f(n) : n \text{ is in the test case} }|, ]
which represents the number of distinct values among ( f(n) ) for all integers in that test case.
Example:
Input: 1 5 1 2 3 4 5</p>Output: 2
inputFormat
The input begins with an integer \( T \) on a single line, representing the number of test cases. Each test case consists of two lines:
- The first line contains a single integer \( M \): the number of integers in the test case.
- The second line contains \( M \) space-separated integers.
It is guaranteed that the input adheres to this format.
outputFormat
For each test case, output a single line containing the number of unique counts of ones in the binary representations of the provided integers.
## sample1
5
1 2 3 4 5
2
</p>