Number of 1 Bits

EasyBit Manipulation
Next
Bit Manipulation

Count how many bits are set to 1 in the binary representation of a non-negative integer (this count is called the Hamming weight).

Input

A single non-negative integer n.

Output

Print the number of 1 bits in n.

Constraints

0 <= n <= 2^32 - 1

Example 1
Input
11
Output
3

11 is 1011 in binary, which has three 1s.

Hints

Number of 1 Bits - Easy Bit Manipulation Problem | Skill Shiksha