while 1: n=-input();x=v=0 while~n:n=n%2*5*n/2+n/2;x+=1;v|=x print v^x