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.
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
typedef long long ll;
using namespace std;

	#define sim template < class c
	#define ris return * this
	#define dor > debug & operator <<
	#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
	sim > struct rge { c b, e; };
	sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
	sim > auto dud(c* x) -> decltype(cerr << *x, 0);
	sim > char dud(...);
	struct debug {
			// #ifdef LOCAL
		~debug() { cerr << endl; }
		eni(!=) cerr << boolalpha << i; ris; }
		eni(==) ris << range(begin(i), end(i)); }
		sim, class b dor(pair < b, c > d) {
			ris << "(" << d.first << ", " << d.second << ")";
		}
		sim dor(rge<c> d) {
			*this << "[";
			for (auto it = d.b; it != d.e; ++it)
				*this << ", " + 2 * (it == d.b) << *it;
			ris << "]";
		}

			// sim dor(const c&) { ris; }
	};
	#ifdef ASJKD
}
	#endif
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define read(x) for(auto &i : (x)){cin>>i;}
#define all(x) begin(x), end(x)
#define pb push_back
#define pii pair<int,int>
#define nxt(x) 2*(x)+1
ll mod = 998244353;
int INF = 1e9+1e8+1e7;
ll INF64 = 1e18;

long long binpow(long long a, long long b, long long m) {
	a %= m;
	long long res = 1;
	while (b > 0) {
		if (b & 1){
			res = res * a % m;
		}
		a = a * a % m;
		b >>= 1;
	}
	return res;
}
int mbit(ll n){
	for(int i=32;i>=0;i--){
		if((n & (1LL<<(i))) > 0){
			return i;
		}
	}
	assert(false);
	return -1;
}
string get(ll n){
	string s = "";
	bool f = 0;
	for(int i=32;i>=0;i--){
		if((n & (1LL<<(i))) > 0){
			s += '1';
			f = 1;
		} else if(f){
			s += '0';
		}
	}
	return s;
}
void test_case(int tnum){
	ll n;
	cin>>n;
	int cnt = 0;
	vector<int> bits(33);
	for(int i=32;i>=0;i--){
		if((n & (1LL<<(i))) > 0){
			bits[i]=1;
			cnt++;
		}
	}
	int last = 1;
	cout <<((1LL<<mbit(n))-1)<<'\n';
}

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(false);
	int t=1;
	cin>>t;
	// init();
	for(int test=1;test<=t;test++){
		test_case(test);
	}
	return 0;
}