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 Main {
    private static final fast sc = new fast();
    private static final BufferedWriter sout = new BufferedWriter(new OutputStreamWriter(System.out));
    private static final int OO = (int) 1e9 + 7;
    private static final double PI = Math.acos(-1);
    //right,down,left,up
    private static final int[] dx4 = {0, 1, 0, -1}, dx = {0, 0, 1, -1, 1, -1, 1, -1};
    private static final int[] dy4 = {1, 0, -1, 0}, dy = {1, -1, 0, 0, 1, -1, -1, 1};
    //static void print6P{ System.out.printf("%8.6f\n"); }

    public static void main(String[] args) throws IOException {
        //Start from here.
        int t = sc.nextInt();
        while (t-- > 0) {
            int n = sc.nextInt(), l = log2(n);
            long res = (long) Math.pow(2, l) - 1;
            /*for (int i = n - 1; i >= 1; i--) {
                n &= i;
                if (n == 0) {
                    sout.write(i + " ");
                    break;
                }
            }*/
            sout.write(res + "\n");
        }
        //end here
        sout.close();
    }

    static int log2(int N) {
        return (int) (Math.log(N) / Math.log(2));
    }

    static class fast {
        BufferedReader br;
        StringTokenizer st;

        fast() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        boolean hasNext() {
            if (st != null && st.hasMoreTokens()) {
                return true;
            }
            String tmp;
            try {
                br.mark(1000);
                tmp = br.readLine();
                if (tmp == null) {
                    return false;
                }
                br.reset();
            } catch (IOException e) {
                return false;
            }
            return true;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        double nextFloat() {
            return Float.parseFloat(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    static class Pair implements Comparable<Pair> {
        long first;
        long second;

        Pair(long first, long second) {
            this.first = first;
            this.second = second;
        }

        @Override
        public int compareTo(Pair o) {
            return Long.compare(second, o.second);
        }

        @Override
        public boolean equals(Object o) {
            if (o instanceof Pair) {
                Pair p = (Pair) o;
                return p.first == first && p.second == second;
            }
            return false;
        }

        @Override
        public int hashCode() {
            return Long.valueOf(first).hashCode() * 31 + Long.valueOf(second).hashCode();
        }
    }

    static class Triple implements Comparable<Triple> {
        String first;
        long second;
        ArrayList<Integer> third;

        Triple(String first, long second, ArrayList<Integer> third) {
            this.first = first;
            this.second = second;
            this.third = third;
        }

        @Override
        public int compareTo(Triple o) {
            if (Math.abs(o.second - second) > 10) {
                return Double.compare(o.second, second);
            } else {
                return first.compareTo(o.first);
            }
        }
    }
}