Added bit manipulation algorithm for counting 1s