bisket = float(input()) #欲しいビスケットの枚数 a = 1 n = 0 while a < bisket: if (a < (bisket / 2)): a = a * 2 n += 1 elif ((bisket - a) % 2) == 0: n += 1 break elif ((bisket - a) == 1): n += 1 break elif ((bisket - a) % 2) == 1: n += 2 break print(n)