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.
/*
   Snippets :-
   1. Binomial (nCr) - nCr Modulo
   2. (x^y)mod m - power
   3. gcd & lcm - gcd
   4. Djisktra - Djikstra
   5. Priority Queue - priority
   6. Disjoint Set Union - dsu
   7. Compare Sort [sort pair with customisation] - compare
*/
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
# define ll  long long  int
# define pb push_back
# define pp pop_back
# define ff first
# define ss second
# define mp make_pair
# define con continue
# define ret return
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
// unordered_map<long long, int, custom_hash> safe_map;
/*
   #include <ext/pb_ds/assoc_container.hpp> 
   #include <ext/pb_ds/tree_policy.hpp> 
   using namespace __gnu_pbds;   
   #define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
   // find_by_order() - Returns an iterator to the k-th largest element (counting from zero)
   // order_of_key()  - The number of items in a set that are strictly smaller than our item
*/
void func()
{
   #ifndef ONLINE_JUDGE
   freopen("in.txt", "r", stdin);
   freopen("out.txt", "w", stdout);
   #endif
   ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
  ll power(ll a, ll b)  
  {
    if(b==0)
      return 1;
    if(b==1)
      return a;
    if(b%2 == 1)
      return (power(a,b-1)*a);
    ll q = power(a,b/2);
    return (q*q);
  }
int32_t  main()
{
   func();
   ll t;
   // t=1;
   cin>>t;  
   while(t--)
   {
      ll n;
      cin>>n;
      vector<ll>arr;
      while(n>0)
      {
        arr.push_back(n%2);
        n=n/2;
      }
      ll ans=arr.size()-1;

      cout<<power(2,ans)-1<<endl;
   }
}


