Total Set Bits


There is an integer given. You have to find the total number of set bits in the binary representation of all numbers ranging from 1 to n.

Write a function solve that have the following parameter(s):
1.) a = an integer

Example
Input:
a = 3
Output:
4

Explanation
For 1: 001 = 1 set bit.
For 2: 010 = 1 set bit.
For 3: 011 = 2 set bits.
The total set bits are 4.

Constraints
• An integer will be greater than or equal to 1 and less than or equal to 108.