Problem Given the integer n, output the smallest m such that nCm (the number of…
- User
Problem
Given the integer n, output the smallest m such that nCm (the number of combinations that choose m out of n different ones) is even.
Constraints
The input satisfies the following conditions.
- 1 ≤ n ≤ 1018
Input
The input is given in the following format.
n
Output
Output the minimum m such that nCm is an even number on one line.
Examples
Input
2
Output
1
Input
111
Output
16
Input
3
Output
4
Assistant
n = int(input()) if (n + 1) & n == 0: print(n + 1) else: print((~n) & (n + 1))
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.