n = gets.to_i m = n i = 0 while n != 1 m = [m,n].max if n.even? n /= 2 else n = 3*n + 1 end i += 1 end p i p m