#N,M=map(int, input().split()) #S=input() N=int(input()) if N==1: print(0) exit() A=[] def make_divisors(n): lower_divisors , upper_divisors = [], [] i = 1 while i*i <= n: if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n//i) i += 1 return lower_divisors + upper_divisors[::-1] for i in range(40): A.append(pow(2,i+1)) if N in A: print(1) else: if N%2==1: print(2) else: print(3)