import java.io.IOException;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import java.io.PrintWriter;

import java.util.HashSet;

@SuppressWarnings("unchecked")
public class Main {
    static int f(int s) {
        int cnt = 0;
        HashSet<Integer> hs = new HashSet<>();

        cnt++;
        hs.add(s);

        boolean flg = true;

        while (flg) {
            int tmp;

            cnt++;

            if (s % 2 == 0) tmp = s / 2;
            else tmp = 3 * s + 1;

            if (hs.contains(tmp)) {
                flg = false;
            }

            hs.add(tmp);

            s = tmp;
        }

        return cnt;
    }

    public static void main(String[] args) throws IOException {
        final String S;

        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            S = reader.readLine();
        }

        PrintWriter out = new PrintWriter(System.out);

        int s = Integer.parseInt(S);

        out.println(f(s));

        out.flush();
    }
} import java.io.IOException; IOException java.io import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io import java.util.HashSet; HashSet java.util public class Main {
    static int f(int s) {
        int cnt = 0;
        HashSet<Integer> hs = new HashSet<>();

        cnt++;
        hs.add(s);

        boolean flg = true;

        while (flg) {
            int tmp;

            cnt++;

            if (s % 2 == 0) tmp = s / 2;
            else tmp = 3 * s + 1;

            if (hs.contains(tmp)) {
                flg = false;
            }

            hs.add(tmp);

            s = tmp;
        }

        return cnt;
    }

    public static void main(String[] args) throws IOException {
        final String S;

        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            S = reader.readLine();
        }

        PrintWriter out = new PrintWriter(System.out);

        int s = Integer.parseInt(S);

        out.println(f(s));

        out.flush();
    }
} Main static int f(int s) {
        int cnt = 0;
        HashSet<Integer> hs = new HashSet<>();

        cnt++;
        hs.add(s);

        boolean flg = true;

        while (flg) {
            int tmp;

            cnt++;

            if (s % 2 == 0) tmp = s / 2;
            else tmp = 3 * s + 1;

            if (hs.contains(tmp)) {
                flg = false;
            }

            hs.add(tmp);

            s = tmp;
        }

        return cnt;
    } f {
        int cnt = 0;
        HashSet<Integer> hs = new HashSet<>();

        cnt++;
        hs.add(s);

        boolean flg = true;

        while (flg) {
            int tmp;

            cnt++;

            if (s % 2 == 0) tmp = s / 2;
            else tmp = 3 * s + 1;

            if (hs.contains(tmp)) {
                flg = false;
            }

            hs.add(tmp);

            s = tmp;
        }

        return cnt;
    } int cnt = 0; cnt 0 HashSet<Integer> hs = new HashSet<>(); hs new HashSet<>() cnt++ cnt hs.add(s) hs.add hs s boolean flg = true; flg true while (flg) {
            int tmp;

            cnt++;

            if (s % 2 == 0) tmp = s / 2;
            else tmp = 3 * s + 1;

            if (hs.contains(tmp)) {
                flg = false;
            }

            hs.add(tmp);

            s = tmp;
        } flg {
            int tmp;

            cnt++;

            if (s % 2 == 0) tmp = s / 2;
            else tmp = 3 * s + 1;

            if (hs.contains(tmp)) {
                flg = false;
            }

            hs.add(tmp);

            s = tmp;
        } int tmp; tmp cnt++ cnt if (s % 2 == 0) tmp = s / 2;
            else tmp = 3 * s + 1; s % 2 == 0 s % 2 s 2 0 tmp = s / 2 tmp s / 2 s 2 tmp = 3 * s + 1 tmp 3 * s + 1 3 * s 3 s 1 if (hs.contains(tmp)) {
                flg = false;
            } hs.contains(tmp) hs.contains hs tmp {
                flg = false;
            } flg = false flg false hs.add(tmp) hs.add hs tmp s = tmp s tmp return cnt; cnt int s s public static void main(String[] args) throws IOException {
        final String S;

        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            S = reader.readLine();
        }

        PrintWriter out = new PrintWriter(System.out);

        int s = Integer.parseInt(S);

        out.println(f(s));

        out.flush();
    } main {
        final String S;

        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            S = reader.readLine();
        }

        PrintWriter out = new PrintWriter(System.out);

        int s = Integer.parseInt(S);

        out.println(f(s));

        out.flush();
    } final String S; S try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            S = reader.readLine();
        } {
            S = reader.readLine();
        } BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in)) BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in)) new BufferedReader(
                new InputStreamReader(System.in)) S = reader.readLine() S reader.readLine() reader.readLine reader PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) int s = Integer.parseInt(S); s Integer.parseInt(S) Integer.parseInt Integer S out.println(f(s)) out.println out f(s) f s out.flush() out.flush out String[] args args public class Main {
    static int f(int s) {
        int cnt = 0;
        HashSet<Integer> hs = new HashSet<>();

        cnt++;
        hs.add(s);

        boolean flg = true;

        while (flg) {
            int tmp;

            cnt++;

            if (s % 2 == 0) tmp = s / 2;
            else tmp = 3 * s + 1;

            if (hs.contains(tmp)) {
                flg = false;
            }

            hs.add(tmp);

            s = tmp;
        }

        return cnt;
    }

    public static void main(String[] args) throws IOException {
        final String S;

        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            S = reader.readLine();
        }

        PrintWriter out = new PrintWriter(System.out);

        int s = Integer.parseInt(S);

        out.println(f(s));

        out.flush();
    }
} public class Main {
    static int f(int s) {
        int cnt = 0;
        HashSet<Integer> hs = new HashSet<>();

        cnt++;
        hs.add(s);

        boolean flg = true;

        while (flg) {
            int tmp;

            cnt++;

            if (s % 2 == 0) tmp = s / 2;
            else tmp = 3 * s + 1;

            if (hs.contains(tmp)) {
                flg = false;
            }

            hs.add(tmp);

            s = tmp;
        }

        return cnt;
    }

    public static void main(String[] args) throws IOException {
        final String S;

        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            S = reader.readLine();
        }

        PrintWriter out = new PrintWriter(System.out);

        int s = Integer.parseInt(S);

        out.println(f(s));

        out.flush();
    }
} Main
import java.io.IOException;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import java.io.PrintWriter;

import java.util.HashSet;

@SuppressWarnings("unchecked")
public class Main {
    static int f(int s) {
        int cnt = 0;
        HashSet<Integer> hs = new HashSet<>();

        cnt++;
        hs.add(s);

        boolean flg = true;

        while (flg) {
            int tmp;

            cnt++;

            if (s % 2 == 0) tmp = s / 2;
            else tmp = 3 * s + 1;

            if (hs.contains(tmp)) {
                flg = false;
            }

            hs.add(tmp);

            s = tmp;
        }

        return cnt;
    }

    public static void main(String[] args) throws IOException {
        final String S;

        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            S = reader.readLine();
        }

        PrintWriter out = new PrintWriter(System.out);

        int s = Integer.parseInt(S);

        out.println(f(s));

        out.flush();
    }
}
