Solve homework2-problem8: Count of Equal Bit Pairs