package main import ( "bufio" "fmt" "os" "strconv" ) var sc = bufio.NewScanner(os.Stdin) func main() { sc.Split(bufio.ScanWords) n := nextUint64() fmt.Println(bitCount(n)) } func bitCount(x uint64) uint64 { x = (x & 0x5555555555555555) + ((x & 0xAAAAAAAAAAAAAAAA) >> 1) x = (x & 0x3333333333333333) + ((x & 0xCCCCCCCCCCCCCCCC) >> 2) x = (x & 0x0F0F0F0F0F0F0F0F) + ((x & 0xF0F0F0F0F0F0F0F0) >> 4) x = (x & 0x00ff00ff00ff00ff) + ((x & 0xff00ff00ff00ff00) >> 8) x = (x & 0x0000ffff0000ffff) + ((x & 0xffff0000ffff0000) >> 16) x = (x & 0x00000000ffffffff) + ((x & 0xffffffff00000000) >> 32) return x } func nextLine() string { sc.Scan() return sc.Text() } func nextInt() int { i, _ := strconv.Atoi(nextLine()) return i } func nextInt64() int64 { i, _ := strconv.ParseInt(nextLine(), 10, 64) return i } func nextUint64() uint64 { i, _ := strconv.ParseUint(nextLine(), 10, 64) return i } func nextFloat() float64 { f, _ := strconv.ParseFloat(nextLine(), 64) return f }