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.

import java.io.*;
import java.util.*;

public class CodeForces extends Functions {
    private static void solve() {
        long val = 1;
        long n = sc.nextInt();
        while (val*2<=n){
            val *=2;
        }
        out.println(val-1);
    }


    public static void main(String[] args) {
        int testCase = 1;
        testCase= sc.nextInt();
        while (testCase-->0) solve();
        sc.close();
        out.flush();
        out.close();
    }

    static Scanner sc = new Scanner(); // Input
    static  PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));  // Fast output
//    static PrintStream out = new PrintStream(System.out);   // output
}


class Functions {
    public static long mod = (long)1e9+7L;
    public static final int INT_MAX = Integer.MAX_VALUE;
    public static final int INT_MIN = Integer.MIN_VALUE;
    public static final long LONG_MAX = Long.MAX_VALUE;
    public static final long LONG_MIN = Long.MIN_VALUE;
    public static final double DOUBLE_MAX = Double.MAX_VALUE;
    public static final double DOUBLE_MIN = Double.MIN_VALUE;
    public static final String YES = "YES";
    public static final String NO = "NO";

    public static void sort(int[] a,boolean isAscending){
        ArrayList<Integer> temp = new ArrayList<>();
        for (int j : a) temp.add(j);
        sort(temp,isAscending);
        for(int i=0;i<a.length;i++)a[i] = temp.get(i);
    }

    public static void sort(List list,boolean isAscending){
        if(isAscending)
            Collections.sort(list);
        else Collections.sort(list,Collections.reverseOrder());
    }
    // euclidean algorithm
    public static long gcd(long a, long b) {
        // time O(max (loga ,logb))
        long x = Math.min(a,b);
        long y = Math.max(a,b);
        if (y % x == 0) return x;
        return gcd(y%x,x);
    }
    public static long lcm(long a, long b) {
        // lcm(a,b) * gcd(a,b) = a * b
        return (a / gcd(a, b)) * b;
    }

    public static long factorial(long n){
        long fact = 1L;
        for(int i=2;i<=n;i++)fact = (fact*i)%mod;
        return fact;
    }
    public static long firstDivisor(long n){
        if(n==1)return n;
        for(long i=2;i*i<=n;i++)
            if(n%i==0)return i;
        return -1;
    }
    public static long power(long x,long n){
        // calculate x^n %mod using binary exponentiation
        // time : O(logn)
        long ans = 1;
        while(n>0){
            if(n%2!=0){
                ans *= x;
                n--;
            }else {
                x *= x;
                n/=2;
            }
            x %=mod;
            ans %=mod;
        }
        return ans;
    }
    public  static int ncr(int n, int r){
        // time O(n+r)
        if (r > n)
            return 0;
        long[] inv = new long[r + 1];
        inv[1] = 1;
        // Getting the modular inversion
        // for all the numbers
        // from 2 to r with respect to m
        for (int i = 2; i <= r; i++) {
            inv[i] = mod - (mod / i) * inv[(int) (mod % i)] % mod;
        }
        int ans = 1;
        // for 1/(r!) part
        for (int i = 2; i <= r; i++) {
            ans = (int) (((ans % mod) * (inv[i] % mod)) % mod);
        }
        // for (n)*(n-1)*(n-2)*...*(n-r+1) part
        for (int i = n; i >= (n - r + 1); i--) {
            ans = (int) (((ans % mod) * (i % mod)) % mod);
        }
        return ans;
    }
    public static void reverseArray(int[] a){
        int left = 0;
        int right = a.length-1;
        while (left<right){
            int temp =a[left];
            a[left] = a[right];
            a[right] = temp;
            left++;
            right--;
        }
    }
}

class Scanner {
    private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private StringTokenizer st = new StringTokenizer("");
    public String next(){
        while (!st.hasMoreTokens())
            try {
                st = new StringTokenizer(br.readLine());
            }catch (IOException e){
                e.printStackTrace();
            }
        return st.nextToken();

    }
    public int nextInt(){return Integer.parseInt(next());}
    public long nextLong(){return Long.parseLong(next());}
    public double nextDouble(){return Double.parseDouble(next());}
    public int[] setintArray(int n){
        int[] arr =new int[n];
        for(int i=0;i<n;i++)arr[i] = nextInt();
        return arr;
    }
    public long[] setlongArray(int n){
        long[] arr =new long[n];
        for(int i=0;i<n;i++)arr[i] = nextLong();
        return arr;
    }
    public int[][] set2DintArray(int row, int col){
        int[][] arr = new int[row][col];
        for(int i=0;i<row;i++)
            for(int j= 0;j<col;j++)
                arr[i][j] = nextInt();
        return arr;
    }
    public long[][] set2DlongArray(int row, int col){
        long[][] arr = new long[row][col];
        for(int i=0;i<row;i++)
            for(int j= 0;j<col;j++)
                arr[i][j] = nextLong();
        return arr;
    }
    public void close(){
        try{
            br.close();
        }catch (IOException e){
            e.printStackTrace();
        }
    }
}
