The firmware also needs a quick population count — how many bits are flipped on in a given sensor register. Read N and print how many bits are set to 1 in its binary representation.
Input
One integer N.
Output
Count of set bits.
Constraints
0 ≤ N ≤ 10^9
Sample Input
13
Sample Output
3
main.c
Loading editor…
Write C, then Run (custom I/O) or Submit (sample tests). ⌘/Ctrl+Enter submits.