def main(): n = int(input()) ans = 0 b = 1 while n > 1: if b * 2 < n: b *= 2 ans += 1 else: if (n - b) % 2 == 0 or (n - b) == 1: ans += 1 else: ans += 2 break print(ans) if __name__ == '__main__': main()