import sys sys.setrecursionlimit(5*10**5) input = sys.stdin.readline from collections import defaultdict, deque, Counter from heapq import heappop, heappush from bisect import bisect_left, bisect_right from math import gcd n = int(input()) cnt = 0 while n != 1: if n % 2 == 1: n += 1 else: while n % 2 == 0: n //= 2 cnt += 1 print(cnt)