package main
import "fmt"

func hitungNomorBit(angka int, nomorBit int) *int {
if nomorBit != 0 && nomorBit != 1 {
return nil }

if angka == 0 {
count := 0
if nomorBit == 0 {
count = 1
}
return &count
}

count := 0
temp := angka

for temp > 0 {
sisa := temp % 2
if sisa == nomorBit {
count++
}
temp = temp / 2
}
return &count

}

func main(){
	fmt.Println(*hitungNomorBit(13,0))
	fmt.Println(*hitungNomorBit(13,1))
	fmt.Println(hitungNomorBit(13,2))
}