2272: Card Game

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:4 解决:2

题目描述

Joe is playing a card game. There is a pile of cards numbered 1, 2, ... n from top to bottom. Every time Joe throws away the top card and puts the second card to the bottom, until there is only one card. Can you tell Joe the number of the last card?

输入

There are multiple test cases (no more than 1000).
Each test case contains only one integer n (1 <= n <= 10^6), the number of cards.

输出

There is only one line for each test case, containing the last card's number.

样例输入 复制

3
6
10

样例输出 复制

2
4
4