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;
typedef long long ll;
typedef long double ld;
#define endl '\n'
#define all(c) c.begin(),c.end()
#define ishu     ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define VL vector<ll>
#define F first
#define S second
#define I insert
#define Fill(a, b) memset(a, b, sizeof(a))
#define SORT(v) sort(v.begin(), v.end());
#define SORTG(v) sort(v.begin(), v.end(), greater<ll>());
#define int ll
#define mod1            1000000007
#define mod2             998244353
#define N 100005
#define loop(i, a, b)		for(ll i=a; i<b; i++)
#define input(arr,n)  for(ll i=0;i<n;++i) cin>>arr[i];
#define see(c)   cout<<c<<" ";
#define seep(x) cout<<#x<<" = "<<"["<<x.first<<","<<x.second<<"]"<<endl;
#define display(V)  for(auto it : V)  {   cout<<it<<" " ;} cout<<endl;
#define display2(V)  for(auto it : V) { for (auto val : it) { cout<<val<<" ";} cout<<endl;}
//-----------------------------INLINE FUNCTIONS----------------------------------//
inline ll gcd(ll a, ll b)          {if (b == 0) return a;    return gcd(b, a % b);}
inline ll lcm(ll a, ll b)          {return (a / gcd(a, b) * b);}
inline bool prime(ll n)            {ll i; for (i = 2; i <= sqrt(n); i++) {if (n % i == 0)return false;} return true;}
//----------------------------------------------------------------------------------------------//
template<typename T>
istream& operator >> (istream& in, vector<T>& v) {
    for (auto& i : v) in >> i;
    return in;
}
void yes(){cout<<"YES"<<endl;}
void no(){cout<<"NO"<<endl;}
//----------------------------------------------------------------------------------------------//
vector<ll> a;
void dp(){
    a.pb(0);
    ll t=2;
    while (true)
    {
        a.pb(t);
        t*=2;
        if(t>=1000000000) break;
    }
    

}
void solve(){
    ll n;
    cin>>n;
    if(n==2){
        cout<<1<<endl;
        return;
    }
    if(n==1){
        cout<<0<<endl;
        return;
    }
    auto t=upper_bound(all(a),n);
    ll index=t-a.begin();
    cout<<a[index-1]-1<<endl;
}

signed main()
{
    ishu
    dp();
    ll T;
    cin>>T;
    while(T--)
    solve();
    return 0;
}