import java.util.*;
public class Main {
static void solve(int n) {
int steps=1;
for(int i=2; i<=n; i=i*2){
steps *= 2;
}
//System.out.println("s "+steps);
if(steps == n){
System.out.println("1");
}else {
int cnt = 1 + (n-steps);
System.out.println(cnt);
}
}
public static void main(String args[]) {
// Your Code Here
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-- > 0) {
int n = sc.nextInt();
solve(n);
}
}
}