N=int(input()) B=1 u=0 while B<=N/2: B*=2 u+=1 N=N-B while N>0: while B<=N/2: B*=2 N=N-B u+=1 print(u)