Print the number of bits set to 1 in the binary representation of N
Input
NOutput
The number of bits set to 1 in the binary representation of N (N < 32)Sample
| Input | Output |
|---|---|
| 3 | 2 |
print sum([x == '1' for x in bin(int(raw_input()))])
| Input | Output |
|---|---|
| 3 | 2 |
print sum([x == '1' for x in bin(int(raw_input()))])