added count_2s algorithm