Given a number N. Find the product of the number of setbits and the number itself.
Example 1:
Input: N = 2
Output: 2
Explaination: 2 has one setbit. So, 2*1 = 2.
Example 2:
Input: N = 3
Output: 6
Explaination: 3 has 2 setbits. 3*2 = 6.
Your Task:
You do not need to read input or print anything. Your task is to complete the function bitMultiply() which takes the number N as input parameters and returns the product.
Expected Time Complexity: O(Log N)
Expected Auxiliary Space: O(1)
Constraints:
1 <= N <= 10^{6}

Difficulty: EASY
Tags: Bit manipulation

Data structures
Skill types: Bit manipulation

Data structures
Expected Time Complexity: O(Log N)
Expected Auxiliary Space: O(1)

Starter code:
#User function Template for python3

class Solution:
    def bitMultiply(self, N):
        # code here

Solutions:
class Solution:

	def bitMultiply(self, N):
		b = str(bin(N).replace('0b', ''))
		c = 0
		for i in b:
			if i == '1':
				c += 1
		return c * N


class Solution:

	def bitMultiply(self, N):
		sum = 0
		t = format(N, 'b')
		for i in t:
			if i == '1':
				sum = sum + 1
		return N * sum


class Solution:

	def bitMultiply(self, n):
		a = ''
		a = bin(n).replace('0b', '')
		k = a.count('1')
		k = int(k)
		return n * k


class Solution:

	def bitMultiply(self, N):
		k = N
		x = 0
		while N != 0:
			if N % 2 == 1:
				x += 1
			N = N >> 1
		return k * x


def count(n):
	ans = 0
	while n:
		ans += 1
		n &= n - 1
	return ans

class Solution:

	def bitMultiply(self, N):
		return count(N) * N


class Solution:

	def bitMultiply(self, N):
		n = bin(N)[2:]
		return N * n.count('1')


class Solution:

	def bitMultiply(self, N):
		t = N
		p = 0
		while t:
			if t & 1:
				p += 1
			t >>= 1
		return N * p


class Solution:

	def bitMultiply(self, N):
		count = 0
		temp = N
		while N:
			if N & 1 == 1:
				count += 1
			N = N >> 1
		k = count * temp
		return k


class Solution:

	def bitMultiply(self, N):
		temp = N
		s = 0
		while temp:
			if temp & 1 == 1:
				s += 1
			temp >>= 1
		return N * s


class Solution:

	def bitMultiply(self, N):
		x = N
		count = 0
		while x:
			if x & 1 == 1:
				count += 1
			if x == 0:
				break
			x = x >> 1
		return N * count


class Solution:

	def bitMultiply(self, N):
		count = 0
		t = N
		while N > 0:
			N = N & N - 1
			count += 1
		return count * t


class Solution:

	def bitMultiply(self, N):
		c = 0
		n = N
		while N > 0:
			if N & 1 == 1:
				c += 1
			N = N >> 1
		a = c * n
		return a


class Solution:

	def bitMultiply(self, N):
		c = 0
		x = N
		while N:
			if N & 1:
				c += 1
			N = N >> 1
		return x * c


class Solution:

	def bitMultiply(self, N):
		k = N
		c = 0
		if N > 0:
			for i in range(32):
				if N & 1 == 1:
					c += 1
				N = N >> 1
		return k * c


class Solution:

	def bitMultiply(self, N):
		a = bin(N)
		b = a.count('1')
		return N * b


class Solution:

	def bitMultiply(self, N):

		def binary(n):
			r = 0
			c = 1
			while n:
				d = n % 2
				n = n // 2
				r = r + c * d
				c *= 10
			return r
		d = binary(N)
		c = str(d)
		c_o = 0
		for i in c:
			if i == '1':
				c_o += 1
		return N * c_o


class Solution:

	def bitMultiply(self, N):
		l = list(str(bin(N)))
		cnt = l.count('1')
		return N * cnt


class Solution:

	def bitMultiply(self, N):
		c = 0
		n = bin(N)
		n = n.replace('0b', '')
		c = 0
		for i in n:
			if i == '1':
				c += 1
		if N > 0:
			return N * c
		else:
			return 0


class Solution:

	def bitMultiply(self, N):
		z = N
		cnt = 0
		while N:
			if N % 2 == 1:
				cnt += 1
			N = N // 2
		return cnt * z


class Solution:

	def bitMultiply(self, N):
		c = 0
		k = N
		while N:
			r = N % 2
			N = N // 2
			if r == 1:
				c += 1
		return k * c


class Solution:

	def bitMultiply(self, N):
		tot = 0
		n = N
		while n > 0:
			tot += n & 1
			n >>= 1
		return tot * N


class Solution:

	def bitMultiply(self, N):
		num = bin(N)[2:]
		count = sum((item == '1' for item in num))
		return N * count


class Solution:

	def bitMultiply(self, N):
		c = bin(N)
		a = 0
		for i in c:
			if i == '1':
				a += 1
		return N * a


class Solution:

	def bitMultiply(self, N):
		k = bin(N)[2:]
		c = k.count('1')
		return c * N


class Solution:

	def bitMultiply(self, N):
		a = bin(N)[2:].count('1')
		return N * a


class Solution:

	def bitMultiply(self, N):
		c = 0
		k = N
		while N > 0:
			c = c + 1
			N = N & N - 1
		return c * k


class Solution:

	def bitMultiply(self, n):
		c = 0
		temp = n
		while n:
			if n & 1:
				c += 1
			n = n >> 1
		return temp * c


class Solution:

	def bitMultiply(self, N):
		count = 0
		res = N
		while N:
			count += int(bool(N & 1))
			N = N >> 1
		return count * res


class Solution:

	def bitMultiply(self, N):
		ans = bin(N)
		a = ans.count('1')
		return a * N


class Solution:

	def bitMultiply(self, N):
		nc = N
		i = 0
		while nc:
			i += 1
			nc &= nc - 1
		return N * i


class Solution:

	def bitMultiply(self, N):
		binary = bin(N).replace('0b', '')
		setBits = binary.count('1')
		return N * setBits


class Solution:

	def bitMultiply(self, N):
		number = N
		count = 0
		while N != 0:
			digit = N % 2
			N = N // 2
			if digit == 1:
				count += 1
		return number * count


class Solution:

	def bitMultiply(self, N):
		num = N
		count = 0
		while N:
			N &= N - 1
			count += 1
		return count * num


class Solution:

	def bitMultiply(self, N):
		m = bin(N).replace('0b', '')
		o = m.count('1')
		return N * o


class Solution:

	def bitMultiply(self, N):
		res = bin(N).replace('0b', '')
		p = res.count('1')
		return p * N


import math

class Solution:

	def bitMultiply(self, N):
		setBits = 0
		temp = N
		while temp:
			if temp & 1 > 0:
				setBits += 1
			temp = temp >> 1
		return N * setBits


class Solution:

	def bitMultiply(self, N):
		b = bin(N)
		c = b.count('1')
		return N * c


class Solution:

	def bitMultiply(self, n):
		b = int(bin(n)[2:])
		s = 0
		while b != 0:
			s += b % 10
			b = b // 10
		return s * n


class Solution:

	def bitMultiply(self, N):
		b = N
		N = bin(N)
		N = list(N[2:])
		ans = N.count('1')
		return b * ans


class Solution:

	def bitMultiply(self, N):
		setBits = 0
		n = bin(N)[2:]
		for i in n:
			if i == '1':
				setBits += 1
		return N * setBits


class Solution:

	def bitMultiply(self, N):
		count = 0
		val = N
		while val:
			count += N
			val = val & val - 1
		return count


class Solution:

	def bitMultiply(self, N):
		return str(bin(N)).count('1') * N


class Solution:

	def bitMultiply(self, N):
		if N < 0:
			return 0
		bit = bin(N)
		st = str(bit)
		summ = 0
		for c in st:
			if c == '1':
				summ = summ + 1
		return N * summ
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = int(input())
		ob = Solution()
		print(ob.bitMultiply(N))


class Solution:

	def bitMultiply(self, N):
		b = bin(N).replace('ob', '')
		l = list(b)
		c = l.count('1')
		return c * N
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = int(input())
		ob = Solution()
		print(ob.bitMultiply(N))


class Solution:

	def bitMultiply(self, N):
		m = bin(N)
		x = m.count('1')
		return N * x
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = int(input())
		ob = Solution()
		print(ob.bitMultiply(N))


class Solution:

	def bitMultiply(self, N):
		count = 0
		n = N
		while n > 0:
			n = n & n - 1
			count += 1
		return count * N
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = int(input())
		ob = Solution()
		print(ob.bitMultiply(N))


class Solution:

	def bitMultiply(self, N):
		ans = 0
		k = N
		while k:
			k = k ^ k & -k
			ans += 1
		return ans * N
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = int(input())
		ob = Solution()
		print(ob.bitMultiply(N))


class Solution:

	def bitMultiply(self, N):
		s = bin(N)
		s = s[2:]
		return N * s.count('1')
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = int(input())
		ob = Solution()
		print(ob.bitMultiply(N))


class Solution:

	def bitMultiply(self, N):
		bit = bin(N)
		count = bit.count('1')
		return N * count


class Solution:

	def bitMultiply(self, N):
		c = 0
		a = int(N)
		while a:
			a &= a - 1
			c += 1
		return c * N


class Solution:

	def bitMultiply(self, N):
		set_bits = [int(b) for b in bin(N)[2:]].count(1)
		return N * set_bits


class Solution:

	def bitMultiply(self, N):
		x = bin(N).replace('0b', '')
		s = str(x).count('1')
		return N * s


class Solution:

	def bitMultiply(self, N):
		x = bin(N).replace('0b', '')
		x = str(x)
		count = 0
		for i in x:
			if i == '1':
				count += 1
		return count * N


class Solution:

	def bitMultiply(self, N):
		cnt = 0
		num = N
		while num != 0:
			if num & 1 == 1:
				cnt += 1
			num = num >> 1
		return N * cnt


class Solution:

	def bitMultiply(self, N):
		totalOne = self.countOnes(N)
		return N * totalOne

	def countOnes(self, N):
		count = 0
		while N:
			if N & 1:
				count += 1
			N = N >> 1
		return count


class Solution:

	def bitMultiply(self, N):
		c = 0
		n = bin(N)
		n = list(n)
		n = n[2:]
		for i in n:
			if i == '1':
				c += 1
		return c * N


class Solution:

	def bitMultiply(self, N):
		count = 0
		M = N
		while N != 0:
			N = N & N - 1
			count += 1
		return count * M


class Solution:

	def bitMultiply(self, N):
		j = str(bin(N).replace('0b', ''))
		k = j.count('1')
		return N * k


class Solution:

	def bitMultiply(self, N):
		a = bin(N)
		count = 0
		for i in a:
			if i == '1':
				count = count + 1
		d = N * count
		return d


class Solution:

	def bitMultiply(self, N):
		c = 0
		t = N
		while N:
			c += N & 1
			N >>= 1
		return t * c


class Solution:

	def bitMultiply(self, N):
		A = bin(N)
		countt = str(A).count('1')
		return N * countt


class Solution:

	def bitMultiply(self, N):
		c = 0
		a = N
		while N:
			if str(N % 2) == '1':
				c += 1
			N //= 2
		return a * c


class Solution:

	def bitMultiply(self, N):
		B = format(N, '0b')
		return N * B.count('1')


class Solution:

	def bitMultiply(self, N):
		count = 0
		a = N
		while N > 0:
			N = N & N - 1
			count += 1
		return count * a