bit manipulation: count ones in binary representation