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.BufferedReader;
import java.io.DataInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;



public class Main{
    private static Parser in;
    private static PrintWriter out;
    
    private static int calc(int n){
        if(n == 1)return 0;
        if(n == 2)return 0;
        return n-2;
        
        
    }
    
    public static void main(String[] args){
        in = new Parser(System.in);
        out = new PrintWriter(System.out);
        int t = in.nextInt();
        
        for(int i = 0; i<t; i++){
            int n = in.nextInt();
            out.println(calc(n));
        }
        

       out.flush();
    }
}


class Parser {
    final private int BUFFER_SIZE = 1 << 16;
    private DataInputStream din;
    private byte[] buffer;
    private int bufferPointer, bytesRead;
 
    public Parser(InputStream in) {
            din = new DataInputStream(in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
    }
    public String nextString(int size) { 
        byte[] ch = new byte[size];
        int point = 0;
        try {
            byte c = read();
            while (c == ' ' || c == '\n' || c=='\r')
                c = read();
            while (c != ' ' && c != '\n' && c!='\r') {
                ch[point++] = c;
                c = read();
            }
        } catch (Exception e) {}
        return new String(ch,0,point);
        }
    public int nextInt() { 
    int ret = 0;
    boolean neg;
    try {
        byte c = read();
        while (c <= ' ')
            c = read();
        neg = c == '-';
        if (neg)
            c = read();
        do {
            ret = ret * 10 + c - '0';
            c = read();
        } while (c > ' ');
    
    if (neg) return -ret;
    } catch (Exception e) {}
    return ret;
    }
    public long nextLong() { 
        long ret = 0;
        boolean neg;
        try {
            byte c = read();
            while (c <= ' ')
                c = read();
            neg = c == '-';
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
                c = read();
            } while (c > ' ');
        
        if (neg) return -ret;
        } catch (Exception e) {}
        return ret;
        }
    private void fillBuffer() {
        try {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
        } catch (Exception e) {}
        if (bytesRead == -1) buffer[0] = -1;
    }
 
    private byte read() {
        if (bufferPointer == bytesRead) fillBuffer();
        return buffer[bufferPointer++];
    }
}