Challenge Information

Title : Total Set Bits
Difficulty : Medium
Solutions : 8
Maximum Score : 100
Completed by You: No
Description :

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
8.

Judocode