n is not equal to 1:
a. If n is even, divide it by 2 using right shift operation.
b. If n is odd and not equal to 3, check the second least significant bit:
i. If it is 0 (binary ends with '01'), decrement n.
ii. If it is 1 (binary ends with '11'), increment n.
c. If n is 3, decrement n.
d. Increment the counter.