#include <stdio.h>
#include <assert.h>
int count_bit(unsigned char byte) {
int ans = 0;
while (byte != 0) {
ans += byte & 1;
byte >>= 1;
}
return ans;
}
int main() {
assert(count_bit(7) == 3);
assert(count_bit(1) == 1);
assert(count_bit(0) == 0);
assert(count_bit(8) == 1);
assert(count_bit(16) == 1);
assert(count_bit(255) == 8);
assert(count_bit(256) == 0);
return 0;
}