Given an integer n, find the maximum value of integer k such that the following condition holds: 

n & (n-1) & (n-2) & (n-3) & ... (k) = 0  where & denotes the [bitwise AND operation.](https://en.wikipedia.org/wiki/Bitwise_operation#AND)

Input

The first line contains a single integer t (1 ≤ t ≤ 3 ⋅ 10^4). Then t test cases follow.

The first line of each test case contains a single integer n (1 ≤ n ≤ 10^9).

Output

For each test case, output a single integer — the required integer k.

Example

Input


3
2
5
17


Output


1
3
15

Note

In the first testcase, the maximum value for which the continuous & operation gives 0 value, is 1.

In the second testcase, the maximum value for which the continuous & operation gives 0 value, is 3. No value greater then 3, say for example 4, will give the & sum 0. 

  * 5   \&   4 ≠ 0, 
  * 5   \&   4   \&   3 = 0. 



Hence, 3 is the answer.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class TaskA {
	//536870911
	static long mod = (long) (1000000000+7);
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		//System.out.println((int)('a'));
		FastReader sc = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		int test = sc.nextInt();
		while(test-->0) {
			long n = sc.nextLong();
			String s = Long.toBinaryString(n);
			
			long answer = (long)Math.pow(2, s.length())-1;
			for(int i = 1;i<=s.length();i++) {
				if(s.charAt(i-1)=='1') {
					long minus = (long)Math.pow(2, s.length()-i);
					answer-=minus;
					break;
				}
			}
			out.println(answer);
			
		}
		
		out.close();
	}
	static class SegTree {
		
		static class Pair {
			long seg, pref, suf, sum;
			public Pair(long a, long b, long c, long d) {
				seg = a;
				pref = b;
				suf = c;
				sum = d;
			}
		}
		Pair[] tree;
		final Pair ZERO = new Pair(0, 0, 0, 0);
		int size;
		
		void build(long[] a) {
			init(a.length);
			build(a, 0, 0, size);
		}
		
		void build(long[] a, int x, int lx, int rx) {
			if(rx-lx==1) {
				if(lx<a.length)
					tree[x] = new Pair(Math.max(a[lx], 0), Math.max(a[lx], 0), Math.max(a[lx], 0), a[lx]);
			} else {
				int m = (lx+rx)/2;
				build(a, 2*x+1, lx, m);
				build(a, 2*x+2, m, rx);
				tree[x] = combine(tree[2*x+1], tree[2*x+2]);
			}
		}
		Pair combine(Pair a, Pair b) {
			return new Pair(Math.max(a.seg, Math.max(b.seg, a.suf+b.pref)),
					Math.max(a.pref, a.sum+b.pref),
					Math.max(b.suf, b.sum+a.suf),
					a.sum+b.sum);
		}
		void init(int n) {
			size = 1;
			while(size<n) {
				size*=2;
			}
			tree = new Pair[2*size-1];
			for(int i = 0;i<tree.length;i++){
				tree[i] = ZERO;
			}
		}
		
		private void set(int i, int v, int x, int lx, int rx) {
			 if(rx-lx==1){
				 tree[x] = new Pair(Math.max(v, 0), Math.max(v, 0), Math.max(v, 0), v);
				 return;
			 }
			 int m = (lx+rx)/2;
			 if(i<m) {
				 set(i, v, 2*x+1, lx, m);
			 } else {
				 set(i, v, 2*x+2, m, rx);
			 }
			 tree[x] = combine(tree[2*x+1], tree[2*x+2]);
		}
		
		void set(int i, int v) {
			set(i, v, 0, 0, size);
		}
		
		Pair calc(int l, int r, int x, int lx, int rx) {
			if(l>=rx || lx>=r) {
				return ZERO;
			}
			
			if(lx>=l && rx<=r) {
				return tree[x];
			}
			
			int m = (lx+rx)/2;
			Pair s1 = calc(l, r, 2*x+1, lx, m);
			Pair s2 = calc(l, r, 2*x+2, m, rx);
			
			return combine(s1, s2);
		}
		
		Pair calc(int l, int r) {			
			return calc(l, r, 0, 0, size);
		}
 
	}
	static class FastReader {
		
		StringTokenizer st;
		BufferedReader br;
		
		public FastReader() {
			br = new BufferedReader(
					new InputStreamReader(System.in));
		}
		
		String next() {
			while(st==null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
		
		double nextDouble() { 
			return Double.parseDouble(next()); 
		} 
		
		String nextLine() {
			String s = "";
			while(st==null || st.hasMoreElements()) {
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return s;
		}
	}
}
