Start: 2025-07-29 20:35:00

暑假训练赛16订正

End: 2025-08-09 00:00:00
Now  2026-08-06 03:24:58  类型: IOI  状态: Ended 

P5. 最小配对数
Description

给定一个正整数 n ,我们需要找到最小的正整数 m ,使得以下三个条件同时成立:

1. n \& m \neq 0

2. n | m \neq 0

3. n \oplus m \neq 0


其中,

- & 表示按位与运算

- | 表示按位或运算

- ⊕表示按位异或运算


所谓异或,是指不同值异或结果为1,相同值异或结果为0,即:

- 0 \oplus 0=0

- 0 \oplus 1=1

- 1 \oplus 0=1

- 1 \oplus 1=0


Input

输入一个正整数 n


Output

输出一个正整数 m,表示满足条件的最小正整数。


Examples

Input

2

Output

3
Hint

本题没有其他样例

- 对于30% 的数据: 1 ≤n ≤100

- 对于60% 的数据: 1 ≤n ≤10^{5}

- 对于100% 的数据: 1 ≤n ≤2 ×10^{9}


Submit

题目参数
Time Limit 1 second
Memory Limit 128 MB
Submit