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.
// Problem: A. And Then There Were K
// Contest: Codeforces - Codeforces Round #721 (Div. 2)
// URL: https://codeforces.com/contest/1527/problem/A
// Memory Limit: 256 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)

/* author: gigawhiz */
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define endl "\n"
#define sd(val) scanf("%d", &val)
#define ss(val) scanf("%s", &val)
#define sl(val) scanf("%lld", &val)
#define debug(val) printf("check%d\n", val)
#define all(v) v.begin(), v.end()
#define PB push_back
#define MP make_pair
#define FF first
#define SS second
#define ll long long int
#define mod 1000000007
#define mod1 998244353
#define clr(val) memset(val, 0, sizeof(val))
#define what_is(x) cerr << #x << " is " << x << endl;
#define OJ                          \
  freopen("input.txt", "r", stdin); \
  freopen("output.txt", "w", stdout);
#define FIO                         \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);                    \
  cout.tie(NULL);

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);
  }
};

// Returns (a * b) % mod
ll prod(ll a, ll b) {
  ll res = 0;
  a %= mod;
  while (b) {
    if (b & 1ll) res = (res + a) % mod;
    a = (2ll * a) % mod;
    b >>= 1ll;  // b = b / 2
  }
  return res;
}

// bool isprime(int x){
//     for(int i = 2; i*i <= x; i++){
//         if(x%i == 0) return false;
//     }
//     return true;
// }
//
ll power(ll a, ll b) {
  ll res = 1ll;
  while (b > 0) {
    if (b % 2ll) res = (res * a) % mod;
    a = (a * a) % mod;
    b /= 2ll;
  }
  return res;
}

ll binaryExponentiation(ll a, ll b) {
  ll result = 1ll;
  while (b > 0) {
    if (b % 2 == 1) result = (result * a) % mod;
    a = (a * a) % mod;
    b /= 2ll;
  }
  return result;
}

ll ModularInverse(ll a) { return binaryExponentiation(a, mod - 2); }

// // Returns factorial of n
// ll fact(ll n)
// {
//     ll res = 1;
//     for (int i = 2; i <= n; i++){
//         res = (res * i)%mod;
//     }
//     return res%mod;
// }
//
// vector<int> ff;
// int fact(int x){
//     if(x == 0) return 1;
//     if(ff[x] != -1) return ff[x];
//     return ff[x] = (x*fact(x-1))%mod;
// }
//
// ll nCr(ll n, ll r)
// {
//     return (fact(n) * ModularInverse((fact(r) * fact(n - r))% mod)) % mod;
// }

///////////////////////////////////////////////////////////////////////////////

void solve() {
  // Code here
  ll n;
  cin >> n;
  cout << power(2,log2(n)) - 1 << endl;
}

signed main() {
  FIO;
  //    int t = 1;
  ll t;
  cin >> t;
  while (t--) {
    solve();
  }
}