#!/usr/bin/env pypy3 def min_num_ops(n): assert 1 <= n res = 0 while n > 1: res += 1 d, m = divmod(n, 2) if m == 0: n = d else: n += 1 return res def main(): print(min_num_ops(int(input()))) if __name__ == '__main__': main()