n = gets.to_i count = 0 b = 1 b *= 2 while b < n while n != 0 if n - b >= 0 n -= b count += 1 end b /= 2 end puts count