Return the number of ones in the binary representation of the absolute value of the integer. This is also known as the population count. Example:
int.bit_count()
>>> n = 19
>>> bin(n)
'0b10011'
>>> n.bit_count()
3
>>> (-n).bit_count()
3
def bit_count(self):
return bin(self).count("1")