n people came to a party. Then those, who had no friends among people at the party, left. Then those, who had exactly 1 friend among those who stayed, left as well. Then those, who had exactly 2, 3, ..., n - 1 friends among those who stayed by the moment of their leaving, did the same.

What is the maximum amount of people that could stay at the party in the end? 

Input

The first input line contains one number t — amount of tests (1 ≤ t ≤ 105). Each of the following t lines contains one integer number n (1 ≤ n ≤ 105).

Output

For each test output in a separate line one number — the maximum amount of people that could stay in the end.

Examples

Input

1
3


Output

1
import java.io.*;
import java.util.*;
import java.math.*;
import java.awt.image.AreaAveragingScaleFilter;
import static java.lang.Math.*;
import java.lang.*;



public class Main{
    static FastScanner in;
    static PrintWriter out;
    final static boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

    public static void main(String[] args) throws FileNotFoundException {
        Locale.setDefault(Locale.US);

        if (ONLINE_JUDGE){
            in = new FastScanner(System.in);
            out = new PrintWriter(System.out);
        }else{
            in = new FastScanner(new File("input.txt"));
            out = new PrintWriter(new File("output.txt"));
        }

        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }


}

class SegmentTree{
    int t[], lazy[];
    int Size;
    public SegmentTree(int size){
        t = new int[size*4];
        lazy = new int[size*4];
        Size = size;
    }

    public void build(int e[], int v, int tl, int tr){
        if (tl==tr) t[v] = e[tl]; else
        {
            int m = (tl+tr) >> 1;
            build(e, v+v, tl, m);
            build(e, v+v+1, m+1, tr);
            t[v] = t[v+v]+t[v+v+1];
        }
    }

    public int get(int v, int tl, int tr, int l, int r){
        push(v, tl, tr);
        if (tl==l && tr==r) return t[v];
        int m = (tl+tr) >> 1;
        push(v+v, tl, m);
        push(v+v+1, m+1, tr);
        if (r<=m) return get(v+v, tl, m, l, r);
        if (l>m) return get(v+v+1, m+1, tr, l, r);
        int a = get(v+v,tl, m, l, m);
        int b = get(v+v+1, m+1, tr, m+1, r);
        return a+b;
    }

    public void push(int v, int tl, int tr){
        if (lazy[v]==1) {
            if (tl != tr) {
                lazy[v + v] ^= 1;
                        lazy[v + v + 1] ^= 1;
            }
            t[v] = (tr - tl + 1) - t[v];
            lazy[v] = 0;
        }
    }

    public void update(int v, int tl, int tr, int l, int r){

        push(v, tl, tr);
        if (tl==l && tr==r) {
            lazy[v]=1;
            push(v, tl, tr);
            return;
        }
        int mid = (tl+tr) >> 1;
        push(v+v, tl, mid);
        push(v+v+1, mid+1, tr);
        if (r<=mid) update(v+v, tl, mid, l, r); else
        if (l>mid) update(v+v+1, mid+1, tr, l, r); else
        {
            update(v+v, tl, mid, l, mid);
            update(v+v+1, mid+1, tr, mid+1, r);
        }

        t[v] = t[v + v] + t[v+v+1];
    }

    public int Get(int l, int r){
        return get(1, 1, Size, l, r);
    }

    public void Update(int l, int r){
        update(1, 1, Size, l, r);
    }

}


class Task {
    final int N = 100100;
    final int Inf = 1000000007;
    int n, x, k;
    Map<Integer, Integer> mp;
    long f[] = new long[N];

    long binpow(long a, long b, long c){
        long r=1;
        while (b>0){
            if ((b&1)>0) r*=a;
            a*=a;
            r%=c;
            a%=c;
            b>>=1;
        }
        return r;
    }

    long inverse(long a, long b, long c){
        return binpow(a, b-2, c);
    }


    boolean lucky(int x){
        boolean ans = true;
        while (x>0){
            int dig = (x % 10);
            if (dig!=4 && dig!=7) ans = false;
            x/=10;
        }
        return ans;
    }

    void inc(Map<Integer, Integer> mp, int pos, int val){
        if (mp.containsKey(pos)) val+=mp.get(pos);
        mp.remove(pos);
        mp.put(pos, val);
    }

    long C(int n, int k){
        if (n<k) return 0;
        if (n==k) return 1;
        /*long p=1;
        for (int i=1; i<=n; i++) p*=i;
        for (int i=1; i<=k; i++) p/=i;
        for (int i=1; i<=n-k; i++)p/=i;*/
        long p=f[n];
        p*=inverse(f[k], Inf, Inf);
        p%=Inf;
        p*=inverse(f[n-k], Inf, Inf);
        p%=Inf;
        return p;
    }

    public void solve(int testNumber, FastScanner in, PrintWriter out) {
        int q = in.nextInt();
        while (q-->0){
int a = in.nextInt();
out.println(max(a-2, 0));
}
    }

}

class Pair implements Comparable<Pair>{
    public int first, second;
    Pair(){
        first=second=-1;
    }
    Pair(int a, int b){
        first = a; second=b;
    }
    @Override
    public int compareTo(Pair b){
        if (first<b.first) return 1; else
        if (first>b.first) return -1; else
        if (second<b.second)  return 1; else return -1;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        char c = (char)42;
        result = (int)(1L*first*second + first + second);
        if (second!=0) result+=first % second;
        if (first!=0) result+=second%first;
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        Pair b = (Pair)obj;
        if (first==b.first && second==b.second) return true;
        return false;
    }

}

class PairComparator implements Comparator<Pair>{

    public int compare(Pair a, Pair b) {
        if (a.first<b.first) return 1; else
        if (a.first>b.first) return -1; else
        if (a.second<b.second)  return 1; else return -1;
    }
}


class FastScanner {
    BufferedReader br;
    StringTokenizer st;

    public FastScanner(File f) {
        try {
            br = new BufferedReader(new FileReader(f));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    public FastScanner(InputStream f) {
        br = new BufferedReader(new InputStreamReader(f));
    }

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

    boolean hasMoreTokens() {
        while (st == null || !st.hasMoreTokens()) {
            String s = null;
            try {
                s = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (s == null)
                return false;
            st = new StringTokenizer(s);
        }
        return true;
    }

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

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

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