a = [0]*1000000

a[0] = int(eval(input()))



for i in range(1,1000000):

  if a[i-1]%2 == 0:

    if a[i-1]/2 in a:

      print((i+1))

      break

    a[i] = a[i-1]/2

  else:

    if 3*a[i-1]+1 in a:

      print((i+1))

      break

    a[i] = 3*a[i-1]+1

import sys

s=int(eval(input()))

dp=[0]*1000001

dp[s]=1

cnt=1

for i in range(1000001):

  if s%2==1:

    s=3*s+1

  else:

    s//=2

  cnt+=1

  if dp[s]==1:

    print(cnt)

    sys.exit()

  else:

    dp[s]=1
a = [0] * 1000000
a[0] = int(eval(input()))
for i in range(1, 1000000):
    if a[i - 1] % 2 == 0:
        if a[i - 1] / 2 in a:
            print((i + 1))
            break
        a[i] = a[i - 1] / 2
    else:
        if 3 * a[i - 1] + 1 in a:
            print((i + 1))
            break
        a[i] = 3 * a[i - 1] + 1

import sys

s = int(eval(input()))
dp = [0] * 1000001
dp[s] = 1
cnt = 1
for i in range(1000001):
    if s % 2 == 1:
        s = 3 * s + 1
    else:
        s //= 2
    cnt += 1
    if dp[s] == 1:
        print(cnt)
        sys.exit()
    else:
        dp[s] = 1

-a = [0] * 1000000 -a[0] = int(eval(input())) -for i in range(1, 1000000): -    if a[i - 1] % 2 == 0: -        if a[i - 1] / 2 in a: -            print((i + 1)) -            break -        a[i] = a[i - 1] / 2 +import sys + +s = int(eval(input())) +dp = [0] * 1000001 +dp[s] = 1 +cnt = 1 +for i in range(1000001): +    if s % 2 == 1: +        s = 3 * s + 1 -        if 3 * a[i - 1] + 1 in a: -            print((i + 1)) -            break -        a[i] = 3 * a[i - 1] + 1 +        s //= 2 +    cnt += 1 +    if dp[s] == 1: +        print(cnt) +        sys.exit() +    else: +        dp[s] = 1