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.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;

import javafx.util.Pair;

import static java.lang.Math.pow;
import static java.lang.Math.abs;
import static java.lang.Math.ceil;

public class Main {
	
	static void pr(int odd) {
		System.out.println(odd);
	}

	static void pr(long[][] ar) {
		for (long i[] : ar) {
			for(long j : i) {
				System.out.print(j + " ");
			}
			System.out.println();
		}
		System.out.println("");
	}
	
	static void pr(int[] ar) {
		for (int i : ar) {
			System.out.print(i + " ");
		}
		System.out.println("");
	}
	
	static void pr(boolean[] ar) {
		for (boolean i : ar) {
			System.out.print(i + " ");
		}
		System.out.println("");
	}
	
	int min(long[] ar, int n) {
		int min = 0;
		for (int i = 0; i < ar.length; i++) {
			min = ar[min] > ar[i] ? i : min;
		}
		return min;
	}
	
	int max(int[] ar) {
		int max = 0;
		for (int i = 0; i < ar.length; i++) {
			max = ar[i] > ar[max] ? i : max;
		}
		return max;
	}

	int max(long[] ar) {
		int max = 0;
		for (int i = 0; i < ar.length; i++) {
			max = ar[i] > ar[max] ? i : max;
		}
		return max;
	}

	int max(List<Integer> ar) {
		int max = 0;
		for (int i = 0; i < ar.size(); i++) {
			max = ar.get(i) > ar.get(max) ? i : max;
		}
		return max;
	}

	int kgv(int a, int b) {
		int ret = 0;
		outer: for (int i = 1; i <= b; i++) {
			for (int j = 1; j <= a; j++) {
				if (b * j > a * i)
					break;
				if (b * j == a * i) {
					ret = a * i;
					break outer;
				}
			}
		}
		return ret;
	}

	int binarySearch(List<Integer> ar, int x, int l, int r) {
		if (l <= r) {
			int mid = l + (r - l) / 2;

			if (ar.get(mid) == x)
				return mid;

			if (ar.get(mid) > x)
				return binarySearch(ar, x, l, mid - 1);
			else
				return binarySearch(ar, x, mid + 1, r);
		}

		return -1;
	}
	
	long choose(double n, double k) {
		double ret = 1;
		for(int i = 0; i < k; i++) {
			ret *= (n - i) / (k - i);
		}
		return (long) ret;
	}
	
	int binarySearch(int[] ar, int x, int l, int r) {
		if (l <= r) {
			int mid = l + (r - l) / 2;

			if (ar[mid] == x)
				return mid;

			if (ar[mid] > x)
				return binarySearch(ar, x, l, mid - 1);
			else
				return binarySearch(ar, x, mid + 1, r);
		}

		return -1;
	}
	
	static void initDp(int n, int m, long init) {
		lookup = new long[n+1][m+1];
		for(int i = 0; i <= n; i++) {
			for(int j = 0; j <= m; j++) {
				lookup[i][j] = init;
			}
		}
	}
	
	static long[][] readLong2DArray(){
		long[][] ret = new long[n][m];
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < m; j++) {
				ret[i][j] = sc.nextLong();
			}
		}
		return ret;
	}
	
	static int[] readIntArray() {
		int[] ret = new int[n];
		for(int i = 0; i < n; i++) {
			ret[i] = sc.nextInt();
		}
		return ret;
	}
	
	static long[] readLongArray() {
		long[] ret = new long[n];
		for(int i = 0; i < n; i++) {
			ret[i] = sc.nextLong();
		}
		return ret;
	}
	
	static Scanner sc = new Scanner(System.in);
	
	static int n, m, k; 
	static int r, x, y;
	static long a, b, c, d, q, h, w;
	static int[] ar;
	static long[][] grid;
	static String s, s1, s2;
	
	static final int mod = (int) pow(10, 9) + 7;
	static final int intm = Integer.MAX_VALUE;
	static final long longm = Long.MAX_VALUE;
	
	static HashMap<Integer, ArrayList<Integer>> adjlist;
	static int root;
	
	static long[][] lookup;
	
	long gcd(int a, int b) {
		long max = 0;
		for(int i = 1; i <= b; i++) {
			if(a % i == 0 && b % i == 0) {
				max = i;
			}
		}
		return max;
	}
	
	long testCase(int n) {
		if(n == 1)
			return 0;
		return (long) pow(2, (int) (Math.log10(n)/Math.log10(2)))-1;
	}

	//B
	public static void main(String[] args) {
		
		final Main main = new Main();
		final StringBuilder sb = new StringBuilder();
		
		//initDp(ar[10], ar[10], -1);
				
		int t = sc.nextInt();
		for(int round = 0; round < t; round++) {
			n = sc.nextInt();
			//ar = readIntArray();
			
			sb.append(main.testCase(n)).append('\n');
		}
		sc.close();
		System.out.println(sb);
		
	}
}