add code to count the set bits in the input