n=int(input()) def func(x): y=0 while 2**y<=x: y+=1 return y ans=0 while n>=1: y=func(n) n-=2**y ans+=y print(y)