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 s = set() now = 2 for i in range(35): s.add(now) now *= 2 if n == 1: print(0) elif n in s: print(1) elif n % 2 == 0: print(3) else: print(2)