$n=<>;$n=$n&1?$n*3+1:$n/2,++$%while$n>1;print$%