Ungetestet:

Rotate A , Left , 1
If A.5=1 Then A=1
Loop