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.
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define L long
#define fi first
#define sec second
#define mod(a) a%1000000007
#define endl "\n"
#define pb(x) push_back(x)
#define pob() pop_back()
#define loop(a,w) for(int i=a;i<w;i++)
#define iton for(int i=0;i<n;i++)
#define itom for(int i=0;i<m;i++)
#define jton for(int j=0;j<n;j++)
#define jtom for(int j=0;j<m;j++)
#define itok for(int i=0;i<k;i++)
#define setbits(x) __builtin_popcount(x)
#define zerobits(x) __builtin_ctzll(x)
#define MX 10000
int N  = 100005;
void fast_io()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
}
void input()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
ll power(ll a, ll n)
{	ll res = 1;
	while (n > 0)
	{	if (n & 1)
			res *= a;
		a *= a; n = n >> 1;
	} return res;
}
ll gcd(ll a, ll b)
{
	if (b == 0) return a;
	return gcd(b, a % b);
}
bool isPrime(int n)
{
	if (n <= 1)
		return false;
	if (n <= 3)
		return true;
	if (n % 2 == 0 || n % 3 == 0)
		return false;

	for (int i = 5; i * i <= n; i = i + 6)
		if (n % i == 0 || n % (i + 2) == 0)
			return false;

	return true;
}

vector<int> pr;
bool prime[100001];
void sieve(int n)
{
	memset(prime, true, sizeof(prime));

	for (int p = 2; p * p <= n; p++)
	{
		if (prime[p] == true)
		{
			for (int i = p * p; i <= n; i += p)
				prime[i] = false;
		}
	}
	// for (int p = 2; p <= n; p++)
	// 	if (prime[p])
	// 		pr.push_back(p);
}
int cal(int n)
{
	int i = 0;
	while (1)
	{
		if (pr[i] > n && !isPrime(pr[i] - n))
			return pr[i] - n;
		else
			i++;
	}
	return 0;
}

bool isPlain(string s, int n)
{
	int i = 0, j = n - 1;
	while (i < j)
		if (s[i++] != s[j--])
			return 0;
	return 1;
}


void solve()
{
	ll n, flag = 0, count = 0, sum = 0, f = 0;
	ll ans = 0, x = -1, y = -1, k, a, b, m = 0, t = 0;
	string s;
	cin >> n;
	k = 1;
	// vector<ll> arr(n);
	// iton cin>>arr[i];

	if (n == 2)
	{
		cout << k;
	}
	else
	{
		while (k < n)
			k *= 2;
		if (k == n)
			cout << k  - 1;
		else
			cout << k / 2 - 1;
	}

}


int32_t main() {
	fast_io();
	input();

	L test = 1;
	cin >> test;

	while (test--)
	{
		solve();
		cout << endl ;
	}
}

