N = int(input()) S = set() ans = 0 flag = False while not flag or (N != 1 and N not in S): flag = True S.add(N) ans += 1 if N%2 == 0: N //= 2 else: N = 3*N+1 print(ans if N == 1 else "infinity")