Given a positive integer n, count the total number of set bits in binary representation of all numbers from 1 to n