Count Ones in Binary
You are given a single integer number n
. Your task is to count the number of 1s in the binary representation of n
and output this count.
Input
The first line contains a single integer n
(1 ≤ n ≤ ).
Output
A single integer: the number of 1s in the binary representation of n
.
Examples
Input | Output |
---|---|
5 | 2 |
1023 | 10 |
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB