count = int(input()) s =str(bin(count)) n = 0 for i in s: if i =='1': n +=1 print(n)
先转二进制后转为字符串,然后进行遍历计算flag增值