이진법을 이용해서 문제를 쉽게 접근하였다.
X = int(input()) lst = [] while X != 0: lst.append(X % 2) X //= 2 print(lst.count(1))