s=int(eval(input()))

a=[s]

for i in range(1000000):

    if a[i]%2==0:

        a.append(int(a[i]/2))

    else:

        a.append(int(3*a[i]+1))

a_duplicate=sorted([j for j in set(a) if a.count(j)>1],key=a.index)

a[a.index(a_duplicate[0])]=0

print((a.index((a_duplicate[0]))+1))  







s=int(eval(input()))

a=[s]

i=0

while True:

    if a[i]%2==0:

        a.append(int(a[i]/2))

        i+=1

    else:

        a.append(int(3*a[i]+1))

        i+=1

    if [j for j in set(a) if a.count(j)>1]:

        a_duplicate=sorted([j for j in set(a) if a.count(j)>1],key=a.index)

        break

a[a.index(a_duplicate[0])]=0

print((a.index((a_duplicate[0]))+1))    









s = int(eval(input()))
a = [s]
for i in range(1000000):
    if a[i] % 2 == 0:
        a.append(int(a[i] / 2))
    else:
        a.append(int(3 * a[i] + 1))
a_duplicate = sorted([j for j in set(a) if a.count(j) > 1], key=a.index)
a[a.index(a_duplicate[0])] = 0
print((a.index((a_duplicate[0])) + 1))

s = int(eval(input()))
a = [s]
i = 0
while True:
    if a[i] % 2 == 0:
        a.append(int(a[i] / 2))
        i += 1
    else:
        a.append(int(3 * a[i] + 1))
        i += 1
    if [j for j in set(a) if a.count(j) > 1]:
        a_duplicate = sorted([j for j in set(a) if a.count(j) > 1], key=a.index)
        break
a[a.index(a_duplicate[0])] = 0
print((a.index((a_duplicate[0])) + 1))

-for i in range(1000000): +i = 0 +while True: +        i += 1 -a_duplicate = sorted([j for j in set(a) if a.count(j) > 1], key=a.index) +        i += 1 +    if [j for j in set(a) if a.count(j) > 1]: +        a_duplicate = sorted([j for j in set(a) if a.count(j) > 1], key=a.index) +        break