Bitcount
Statement
Goal
Count the number of ones in the binary representation of each given integer.Input
Line 1 : The number of values N to handle.
N next lines : An integer X on each line.
N next lines : An integer X on each line.
Output
For each integer X, the number of ones in its binary representation.
Constraints
1≤N<10
0≤X<2^32
0≤X<2^32
Example
Input
3 5 2 7
Output
2 1 3
Game modes
Fastest, Shortest
Test cases
Test n°1 Test
Input
3
5
2
7
Output
2
1
3
Validator n°1 Validator
Input
5
9
8
3
7
1
Output
2
1
2
3
1
Test n°2 Test
Input
5
0
1
1024
1025
1057
Output
0
1
1
2
3
Validator n°2 Validator
Input
5
0
1
512
513
561
Output
0
1
1
2
4
Test n°3 Test
Input
5
5099
14039
95
6001
6948
Output
9
10
6
8
6
Validator n°3 Validator
Input
5
23428
18754
13597
3933
18172
Output
7
5
8
9
9
Test n°4 Test
Input
4
255
65535
4294967295
18446744073709551615
Output
8
16
32
64
Validator n°4 Validator
Input
4
200
60000
4000000000
10000000000000000000
Output
3
7
13
19
Solution language
Solution
Stub generator input