Broadcom software such as VMware vSphere may inspect integer bitmasks to determine which feature flags are enabled. Given a non-negative integer n, return the number of 1 bits in its binary representation.
Use bitwise operations rather than converting the integer to a binary string. The binary representation should not include leading zeroes.
Implement count_set_bits(n):
n, a non-negative integer.1 bits, in n.def count_set_bits(n):