#C6111. Count Ones in Binary Representation
Count Ones in Binary Representation
Count Ones in Binary Representation
You are given a non-negative integer n such that \(0 \leq n \leq 1000\). Your task is to compute the number of 1's in the binary representation of n. In other words, if the binary representation of n is \(b_kb_{k-1}\dots b_0\), you should calculate:
\[ \sum_{i=0}^{k} b_i \]
The input will be provided via standard input and the output must be printed to standard output. Make sure your solution handles all valid inputs within the given range.
inputFormat
The input consists of a single integer n (0 <= n <= 1000
) read from standard input.
outputFormat
Output a single integer, the number of 1's in the binary representation of n, to standard output.
## sample0
0