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.*;

import javax.sound.sampled.ReverbType;

import java.awt.Paint;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;

/*
 * @author GOURAV KUMAR
 */
public class MyCpClass {

	// comment out to use Fast reader
	static BufferedReader in;
	static FastScanner scn;
	static PrintWriter out;

//	static Scanner scn = new Scanner(System.in);

	public static void main(String[] args) throws Exception {

		// comment out when using fast reader
		PrintWriter out = new PrintWriter(System.out);
		in = new BufferedReader(new InputStreamReader(System.in));
		scn = new FastScanner(in);

//----------------------------------------Main Code Goes Here-------------------------------------------->>>
		int t = scn.nextInt();

		while (t-- > 0) {
			int n = scn.nextInt();

			int val = 1;
			while (val < n) {
				val = val * 2;
			}
			if (val > n) {
				val /= 2;
			}
			out.println(val - 1);
		}

//--------------------- comment out when using fast reader------------------------------------

//		int a = scn.nextInt();
//		long b = scn.nextLong();
//		double c = scn.nextDouble();
//		String d = scn.nextToken();
//		out.println(a);
//		out.println(b);
//		out.println(c);
//		out.println(d);
		out.flush();
//---------------------------------------------------------------------------------------------		

//-----------------------------------Code Ends Here--------------------------------------------		
	}

// functions made during contest---->

//--------------------------------Some functions to use frequently-----------------------------

	public static int anytoanyconversion(int n, int s, int d) {
		int res1 = anytoD(n, s);
		int ans = Dtoany(res1, d);
		return ans;
	}

	public static int anytoD(int n, int s) {
		int multiplier = 1;
		int ans = 0;
		while (n != 0) {
			int rem = n % 10;
			ans = ans + (rem * multiplier);
			multiplier = multiplier * s;
			n /= 10;
		}
		return ans;
	}

	public static int Dtoany(int res1, int d) {
		int multiplier = 1;
		int ans = 0;
		while (res1 != 0) {
			int rem = res1 % d;
			ans = ans + (rem * multiplier);
			multiplier = multiplier * 10;
			res1 /= d;
		}
		return ans;
	}

	static boolean checkPerfectSquare(double number) {
		// calculating the square root of the given number
		double sqrt = Math.sqrt(number);
		// finds the floor value of the square root and comparing it with zero
		return ((sqrt - Math.floor(sqrt)) == 0);
	}

	static int sumOfDigits(long x) {
		int ans = 0;
		while (x > 0) {
			ans += x % 10;
			x /= 10;
		}
		return ans;
	}

	static int numOfDigits(long x) {
		int ans = 0;
		while (x > 0) {
			x /= 10;
			ans++;
		}
		return ans;
	}

	public static void ArrayInput1D(int[] arr) throws Exception {

		for (int i = 0; i < arr.length; i++) {
			arr[i] = scn.nextInt();
		}
	}

	public static void ArrayInput2D(int[][] arr) throws Exception {
		for (int i = 0; i < arr.length; i++) {
			for (int j = 0; j < arr[0].length; j++) {
				arr[i][j] = scn.nextInt();
			}
		}
	}

	public static int max(int i, int j) {
		return i > j ? i : j;
	}

	public static int min(int i, int j) {
		return i < j ? i : j;
	}

	public static void swap(int[] arr, int i, int j) {
		int temp = arr[i];
		arr[i] = arr[j];
		arr[j] = temp;
	}

	public static HashMap<Integer, Integer> IntMap(int[] arr) {

		HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
		for (int i = 0; i < arr.length; i++) {
			int temp = arr[i];
			map.put(temp, map.getOrDefault(temp, 0) + 1);
		}

		return map;
	}

	public static HashMap<Character, Integer> CharMap(String str) {
		HashMap<Character, Integer> map = new HashMap<Character, Integer>();
		for (int i = 0; i < str.length(); i++) {
			char temp = str.charAt(i);
			if (map.containsKey(temp)) {
				map.put(temp, map.get(temp) + 1);
			} else {
				map.put(temp, 1);
			}
		}

		return map;
	}

	public static long gcd(long a, long b) {
		if (b == 0)
			return a;

		return gcd(b, a % b);
	}

	public static long lcm(long a, long b) {
		return (a * b) / gcd(a, b);
	}

	public static long gcdArray(long[] arr) {
		long ans = arr[0];
		for (int i = 1; i < arr.length; i++) {
			ans = gcd(ans, arr[i]);
		}
		return ans;
	}

	static void sort(int a[]) {
		ArrayList<Integer> al = new ArrayList<>();
		for (int i : a)
			al.add(i);
		Collections.sort(al);
		for (int i = 0; i < a.length; ++i)
			a[i] = al.get(i);
	}

	public static boolean isPrime(int number) {
		for (int i = 2; i <= Math.sqrt(number); i++) {
			if (number % i == 0)
				return false;
		}
		return true;
	}

	public static ArrayList<Integer> primeFactors(int n) {
		ArrayList<Integer> list = new ArrayList<Integer>();
		// Print the number of 2s that divide n
		while (n % 2 == 0) {
			list.add(2);
			n /= 2;
		}

		// n must be odd at this point. So we can
		// skip one element (Note i = i +2)
		for (int i = 3; i <= Math.sqrt(n); i += 2) {
			// While i divides n, print i and divide n
			while (n % i == 0) {
				list.add(i);
				n /= i;
			}
		}
		// This condition is to handle the case whien
		// n is a prime number greater than 2
		if (n > 2)
			list.add(n);
		return list;
	}

	// to find (x^y)%p in O(log y)
	public static int ModExp(int x, int y, int p) {
		int res = 1; // Initialize result
		x = x % p; // Update x if it is more than or
		// equal to p
		if (x == 0)
			return 0; // In case x is divisible by p;
		while (y > 0) {
			// If y is odd, multiply x with result
			if ((y & 1) != 0)
				res = (res * x) % p;
			// y must be even now
			y = y >> 1; // y = y/2
			x = (x * x) % p;
		}
		return res;
	}

	public static int FastExponentiation(int x, int n) {
		if (n == 0)
			return 1;
		int pn;
		int pnm1 = FastExponentiation(x, n / 2);

		if (n % 2 == 0)
			pn = pnm1 * pnm1;
		else
			pn = pnm1 * pnm1 * x;
		return pn;

	}

	public static int rangeSum(int[] arr, int lo, int hi) {
		// prefix array sum
		int[] pre = new int[arr.length];
		pre[0] = arr[0];
		for (int i = 1; i < arr.length; i++)
			pre[i] = arr[i] + pre[i - 1];

		if (lo == 0)
			return pre[hi];

		return pre[hi] - pre[lo - 1];
	}

	static class Pair {
		int x;
		int y;

		public Pair(int x, int y) {
			this.x = x;
			this.y = y;
		}
	}

//---------------------------------Fast reader class-----------------------------------	
	static class FastScanner {
		BufferedReader in;
		StringTokenizer st;

		public FastScanner(BufferedReader in) {
			this.in = in;
		}

		public String nextToken() throws Exception {
			while (st == null || !st.hasMoreTokens()) {
				st = new StringTokenizer(in.readLine());
			}
			return st.nextToken();
		}

		public int nextInt() throws Exception {
			return Integer.parseInt(nextToken());
		}

		public long nextLong() throws Exception {
			return Long.parseLong(nextToken());
		}

		public double nextDouble() throws Exception {
			return Double.parseDouble(nextToken());
		}
	}
//---------------------------------------------------------------------------------------	
}