[algorithm] Count number of 1's in binary representation